I am using rich dataTable with binding attribute and an actionListener to get selected row
<rich:dataTable width="100%" rows="10" id="dataTableIdentifier" value="#{viewScopedBean.getSomeList}" var="itr" align="center" >
<h:commandLink action="#{viewScopedBean.editMethod}" id="method_edit" />
</dataTable>
The editMethod is called twice.
Reason why the editMethod called twice is because of binding variable(Strange but true)
This is because my bean is viewScoped, viewScope + binding is not a good combination.
if you really want to use binding then go for Request scope and you are all set.
if your design forces you to use view scope then use setPropertyActionListener instead of binding.
Here there is another problem in using setPropertyActionListener, this can be used only with action method in the commandLink, because your setPropertyLisener should set the required object before you call the CommandLink action. (All the actionListeners will be called before calling action)
<rich:dataTable width="100%" rows="10" id="dataTableIdentifier" value="#{viewScopedBean.getSomeList}" var="itr" align="center" >
<h:commandLink action="#{viewScopedBean.editMethod}" id="method_edit" />
</dataTable>
The editMethod is called twice.
Reason why the editMethod called twice is because of binding variable(Strange but true)
This is because my bean is viewScoped, viewScope + binding is not a good combination.
if you really want to use binding then go for Request scope and you are all set.
if your design forces you to use view scope then use setPropertyActionListener instead of binding.
Here there is another problem in using setPropertyActionListener, this can be used only with action method in the commandLink, because your setPropertyLisener should set the required object before you call the CommandLink action. (All the actionListeners will be called before calling action)
No comments:
Post a Comment