my dog learned polymorphism
The moose likes JSF and the fly likes Having a hard time getting started with JSF. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Having a hard time getting started with JSF." Watch "Having a hard time getting started with JSF." New topic

Having a hard time getting started with JSF.

Brian Knoblauch

Joined: May 28, 2010
Posts: 12
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

Joined: Jun 25, 2001
Posts: 17417

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.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Having a hard time getting started with JSF.
It's not a secret anymore!