aspose file tools*
The moose likes JSF and the fly likes a4j:commandLink action not working in rich:datatable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "a4j:commandLink action not working in rich:datatable" Watch "a4j:commandLink action not working in rich:datatable" New topic
Author

a4j:commandLink action not working in rich:datatable

Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

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.


My Blog SCJP 5 SCWCD 5
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

Thanks Tim. It was a nice explanation.
 
Don't get me started about those stupid light bulbs.
 
subject: a4j:commandLink action not working in rich:datatable