• 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

Datatable not updating when clicking on commandlink

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using JSF1.2 and Richfaces 3.3 and have a datatable with a column that contains an up arrow and another column that has a down arrow. These allow you to move the row up and down. However, when I click on them, the moveUp method in the bean is triggered and the order is updated, but I don't see this in my browser. When I trigger it again, I can tell (with printlns) that the order is reset to what was originally retrieved from the database.
Below is an extract of my JSP and bean. Please help
 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A commandLink will never execute if any data on the form fails valiadation. That's the most common problem people have - they didn't put a general "errors" tag on the page, forgot to set a field value, and the message was lost.

However, in this case, I think it's most likely that your actionListener is invalid. You provided a "throws Exception" clause to the method signature and I think that disqualifies it from being seen by the EL processor. If you need to throw an exception, wrap it in a JSFException. They're unchecked, so they don't need to be declared in the signature.

In any event, there's no benefit in using an actionListener here. You should use a simple "action" instead.
 
Andrew Dambrosio
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just tried what you said and it made no difference. The datatable is not rerendered properly. At the end of the moveUp method, the order is correct. But it seems like between the end of that method and the re-render, the changes are lost. I added a <h:messages> tag and there is no error.
 
Tim Holloway
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm a little confused here. You're showing code for binding a dataTable, although for this particular function, there's no need for binding.

But you're not showing how you defined the DataModel object that wraps your data for the table, and that's the critical part.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic