I have an <a4j:commandLink> in a <rich:datatable>. The same problem applies to <a4j:commandButton> and <a4j:repeat>. The bean action specified was not executed, and the <a4j:actionparam> values were not bound.
For example this was not working:
<a4j:form> <rich:dataTable id="searchResults" value="#{myBean.searchResults}" var="item"> <rich:column> <a4j:commandLink value="#{item.code}" action="#{myBean.myAction}" reRender="myRegion"> <a4j:actionparam name="code" value="#{item.code}" assignTo="#{myBean.selectedCode}"/> </a4j:commandLink> </rich:column> </rich:dataTable> </a4j:form>
The region was getting rerendered, but myBean.myAction was not executed.
Then I tried moving the <a4j:form> inside the table, so there was a form on each row:
<rich:dataTable id="searchResults" value="#{myBean.searchResults}" var="item"> <rich:column> <a4j:form> <a4j:commandLink value="#{item.code}" action="#{myBean.myAction}" reRender="myRegion"> <a4j:actionparam name="code" value="#{item.code}" assignTo="#{myBean.selectedCode}"/> </a4j:commandLink> </a4j:form> </rich:column> </rich:dataTable>
This seemed to work for the first row, but not any subsequent ones.
The answer seems to be to base the dataTable on a session scoped bean. I didn’t want my orignal bean session scoped, so I split it into two like this:
<rich:dataTable id="searchResults" value="#{mySessionBean.searchResults}" var="item"> <rich:column> <a4j:form> <a4j:commandLink value="#{item.code}" action="#{myBean.myAction}" reRender="myRegion"> <a4j:actionparam name="code" value="#{item.code}" assignTo="#{myBean.selectedCode}"/> </a4j:commandLink> </a4j:form> </rich:column> </rich:dataTable>
And it works. The actions are still carried out on my request bean as I wanted and I just have to be careful about how I update the session bean.
Thank you so much :) ! I’ve spent so many hours on this issue, and your example help my figure it out how to solve it. Thank you, thank you, thank you.
Same comment : I’ve lost a lot of time concerning this issue and your solution works !
it’s just great !
Thanks
I had the same problem, but solved it by adding the attribute ajaxSingle=”true” to the a4j:commandLink
Hello, thank you so much much much ….. ^^. I’ve spend a lot of time finding solution to this issue. And now, great!!!!
Thanks a lot again!!!!
Hi,
Thanks for your help in this case. I was trying quite a lot possibility.
In my case the tip with the ajaxSingle=”true” did the trick.
thanks for your case!
Hello!, thanks, I had the same problem, but solved it by adding the attribute ajaxSingle=”true” to the a4j:commandLink
Great tip, I’ve faced the same problem in Seam 2.2.0 GA and had to change the scope of the action to Session.
@Scope(ScopeType.SESSION)
Thanks. You saved me hours of work. Much appreciated. Good to see that over a year later this article is still helping people.
hi to all , the solution you published is ok for all others .
but in my case its not working fine even i add ajaxSingle=”true” also.
thanks anyway
ho everybody.
I got the same problem, but i don’t want to set the scope of the bean to session ( i want to keep it request because i have too much data to load, and it’s not good if you want better performances )
Is there a solution for that ?
I also need to thank this post, it saved me after LOADS of hair pulling!!
Hi everybody. i had the same problem, but i found out( i don’t know why) that some configuration in my web.xml is the source of my problems:
com.sun.faces.verifyObjects
false
com.sun.faces.IS_SAVE_BINDINGS_STATE
false
when i removed these lines, my commenadLink worked like a charm. HTH
I meet the same problem. My solution is: put the rich:datatable id into the a4j:commandLink’s reRender attributes. After each click, The datatable will be refreshed.
i was having the same problem.including AjaxSingle = “true” did the work. thanks to Joergen..
Just to add my solution:
For me changing from reRender to render solved the issue magically. confirmPanel is my panel in the popup