Sunday 15 April 2012

jsf 2 - How to refer to a bound component in a DataTable with EL? -


How can I access a component using expression language which is bound and repeated in a statistic?

  & lt; H: Dataable value = "# {bean.it}" var = "item" id = "table" & gt; & Lt; H: column & gt; & Lt; H: Input Text = "# {item.name}" id = "name" binding = "# {mybing}" /> & Lt; / H: column & gt; & Lt; / H: datatable & gt;   

Should I give each binding a generational name with a combination of a lexical and row index, for example ('mybinding_1', 'mybinding_2', and so forth), and if so , Then,

or instead there is a way to get a specific element with # {mybinding} and some types of brace notation ( [] < / Code>)?

Here is a misconception that the component tree must have physically multiple & lt; H: inputText & gt; No components Parents are only one component based on the current state of the table component whose HTML presentation is generated multiple times. You can confirm this by going through the components tree starting with FacesContext # getViewRoot () , you can finally confirm only & lt; H: Input Text & gt; component.

Then, binding = "# {mybinding}" is absolutely fine.

If you are having trouble with it, then the reason is to solve it differently and only when you use it to generate several components physically in a loop. Such as JSTL & lt; C: forEach & gt; , then actually physically many & lt; H: inputText> and; Components in Component Tree and you have to pair them with array or map. But this is not clearly the case at present.

No comments:

Post a Comment