• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

commandLink with <rich:dataTable>, problem in pagination

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am trying to use <h:commandLink> inside <rich:dataTable> and I am using <rich:datascroller> for pagination.
first column in the dataTable is displayed using <h:commandLink>.
The problem I am facing is that on the first page of dataTable, the links are working fine and the action method is getting called on click of the link.
But on any of the other pages, when i click any of the commandLink, the action method doesnt get called and the first page gets rendered on the UI.
I have tried changing the scope of my bean from request to session. I even tried changing the <h:commandLink> to <a4j:commandLink>. The only difference that <a4j:commandLink> makes is that, now instead of rendering the first page, nothing happens on click of commandLink on any of those pages. The first page works fine with <a4j:commandLink> also.
I have also verified that I am not using any nested forms.

This is what the code looks like:


I need the resolution urgently. Any help is appreciated.

Thanks in advance.
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Harpreet,

I know JSF can annoying in these matters, However probably there could be two reasons for this either you have a validation errors that prevents the execution of your action, or the getter method for your datatable doesn't return the same number of records during postback.
My guess is the second one, however to make sure it is not the first one please add h:messages to your page to display all validation errors.
If you are sure there is no validation errors, add more logs or try to debug your getter method in the post back (when you click the commandLink) and make sure it returns the same rows it displayed before (especially the same number of rows).

Enjoy


 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I strongly agree with Shafik.

Rather to use h:messages, you should use rich:messages with globalOnly="true": this displays all the Validation errors AJAX + NON AJAX and your are using rich:dataScroller so there may be a chance of AJAX errors.

PLease upload the code of your #{formActionsBean.results} method, as Shafik said, there may be a chance of error in this code.. also check the submittedValue and the Value attribute while clicking on the Pagination
 
Sumeet Singh Aryan
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try the following code.... what is your JSF Version and RichFaces Version???



I have added the <f:View>, <rich:columGroup> and <h:column>

I am using JSF 2.0 and RichFaces 3.3.3 and the richDatatable is working fine in my code.

Please try the code and let me know for further issues
 
Harpreet Parmar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Thanks for the replies. I tried putting <h:messages> and also <rich:messages>, but no error is displayed on the page.
I tried putting logs in the action method that returns the list to datatable, and it appears to be fine. There are currently 23 records in the list, and every time i click on any page number on the datascroller, the list returns exactly 23 results.

I tried the code given by Sumeet also but that also didnt work for me. I am using JSF 1.2 with Richfaces 3.3.3
I have tried using JSF 2.0 JARs also, still the problem persists.

Does anyone know anything else regarding this?

 
Hany Shafik
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Harpreet,

I tried putting logs in the action method that returns the list to datatable, and it appears to be fine.



It shouldn't be an action method it should be a getter method, please check the getter methods in post back does it return the same rows.
The problem could be your action method is fired after the getter is called especially during the decode phase.
Also posting your code is going to help.
 
Harpreet Parmar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Shafik,

Yh thats a getter only, my bad. And it is returning the same number of rows on every click of any page number on dataScroller.

This is the code from FormActionsBean:


And this is the code from FormulaService (Using Hibernate here):


I am still stuck with this problem. Any help is highly appreciated.
 
Hany Shafik
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure, but can you check whether or not the request parameters has command link id as one of it's parameters
 
Harpreet Parmar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I figured out the root cause for the problem. As I am using facelets in my application, in my web.xml the facelets.BUILD_BEFORE_RESTORE was set to true:




Changing it to false, solved the problem. There is no proper documentation available for this parameter, but looking for more info about it, I found many people complaining about it as it causes problems with Ajax. So I think the combination of Richfaces with this parameter set to "true" was the main problem.

But I have found that if this param is set to false, then if the session times out, a ViewSessionExpired exception gets thrown.

Is there anyone who have any similar scenario?
It will be great if someone can share any insights about this param.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic