How does the 'binding' attribute work in JSF? When and how should it be used?

后端 未结 2 1152
礼貌的吻别
礼貌的吻别 2020-11-21 05:10

There are lot of materials out there differentiating value attribute and binding attribute in JSF.

I\'m interested in how both approaches d

2条回答
  •  抹茶落季
    2020-11-21 05:43

    each JSF component renders itself out to HTML and has complete control over what HTML it produces. There are many tricks that can be used by JSF, and exactly which of those tricks will be used depends on the JSF implementation you are using.

    • Ensure that every from input has a totaly unique name, so that when the form gets submitted back to to component tree that rendered it, it is easy to tell where each component can read its value form.
    • The JSF component can generate javascript that submitts back to the serer, the generated javascript knows where each component is bound too, because it was generated by the component.
    • For things like hlink you can include binding information in the url as query params or as part of the url itself or as matrx parameters. for examples.

      http:..../somelink?componentId=123 would allow jsf to look in the component tree to see that link 123 was clicked. or it could e htp:..../jsf;LinkId=123

    The easiest way to answer this question is to create a JSF page with only one link, then examine the html output it produces. That way you will know exactly how this happens using the version of JSF that you are using.

提交回复
热议问题