This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

a4j:commandLink action not working in rich:datatable  RSS feed

 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was trying to put <a4j:commandLink> in <rich:datatable> but it was not working. None of its action or actionListener were getting called. After wasting a lot of time and trying a lot I found that the value{Collection} used for dataTable has to be in session scoped bean. If it is in request scoped bean then the action is not getting executed.

Can someone help me to understand this strange behavior?

Thanks in advance.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know about not getting executed, but execution can definitely fail.

Request-scope beans have very short lived. They only exist for a single request - for example, the one that presented the datatable.

Unfortunately, when you are attempting to select a row in a datatable for further processing, that requires a second request. Since the original request was destroyed, a new request bean gets constructed. But it doesn't have the row context that the previous request did. That's why you need a session-scope object. So it will survive over multiple requests and maintain the datamodel and current row indicators.
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim. It was a nice explanation.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!