This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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: 15959
    
  19

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: a4j:commandLink action not working in rich:datatable
 
Similar Threads
Clearing h:inputText value
How to get row index in a dynamic table?
commandLink with <rich:dataTable>, problem in pagination
Target component for id pan not found
How to identify which commandLink was clicked? [SOLVED]