RSS

a4j:commandLink action not working in rich:datatable

22 Jun

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.

Owing to some performance issues I was not willing to put the bean in session so I splited the bean into two parts: one having the session related properties and other were having all the properties whose states were not needed to be maintained.

Looks like this is an error in the implementation. Also <h:comandLink> doesnt work in <rich:datatable>. The reason is unknown till date. Hope we will find it soon.

According to Tim Holloway of Javaranch:  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.

Advertisements
 
4 Comments

Posted by on June 22, 2009 in JSF

 

4 responses to “a4j:commandLink action not working in rich:datatable

  1. Kumar

    July 2, 2009 at 1:31 pm

    Hi Himanshugpt ,

    You can use to keep bean live to use with

     
    • himanshugpt

      July 3, 2009 at 1:17 pm

      Please explain it in somewhat more detail. I am not able t o get what are you aiming at.

       
  2. technicalbrainwave

    September 22, 2009 at 8:08 am

    Try !!..a4j:keepAlive extends the live cycle for request scope beans and also allows to reuse the same value for a request scope bean between several Ajax requests.

     
    • himanshugpt

      October 5, 2009 at 12:48 pm

      Thanks for the suggestion. Will definitely give it a try..

       

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: