• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Having a hard time getting started with JSF.

 
Brian Knoblauch
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new to JEE. Started out with some Spring for doing reports, but it seemed overly complex for what I was doing so I switched and did more reporting type functions in straight JSP/JSTL. I read that's deprecated by JSF, so figured I'd make that switch. No problems doing my reporting web pages in JSF, conversion was very straightforward. However, despite having read hundreds of pages of documentation and feeling like I understand the JSF model, I can't figure out what to type in to make it do what I want! :-O

Here's one of my most basic problems that I've exhausted all my ideas on how to attack. Solving this one may very well open the doors on the rest and allow me to complete those tasks without further help!

- I have a datatable displaying a list of items. I'd like to force a reload of the datatable by a button click event. I think I'm attaching code as an action, but it never seems to get called. Even once I do figure out why it's not getting called, I'm not sure how to tackle telling the webpage/DOM to get the new datatable contents and display it.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17995
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your problem is most likely because you're expecting things to be more complicated than they are. At least that's what most people's JSF problems are.

First of all, it's always a good idea to put a <h:messages> element in your view. This ensures that if there's an error in JSF that you'll see it displayed. One of the biggest frustrations in JSF is due to the fact that data isn't updated and actions aren't fired unless the data is value. So this will display any messages due to validation failure. It's good to have while debugging, even if you have per-control ("message for=") elements as well, since a miskeyed ID can "lose" a message.

Secondly, the way to update the table display is simply to update the table's datamodel. If you do that, the new data will automatically display when the action is fired and the page renders anew.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic