This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSF and the fly likes Updating Backing Bean Properties using commandLink Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » JSF
Bookmark "Updating Backing Bean Properties using commandLink" Watch "Updating Backing Bean Properties using commandLink" New topic

Updating Backing Bean Properties using commandLink

Darren Carter
Ranch Hand

Joined: Jul 08, 2010
Posts: 30
Hi Everyone,

Can any one tell me how to update the backing bean proprties from the JSF as soon as the user clicks my command link button?

The problem I have is that the page has another form which also maintains (viewBookingBean.fromRange and viewBookingBean.toRange) and this can override the backing bean properties in the above form.

Also the validation is triggered first, so what I need is

1) Once user clicks "Download data as CSV"
2) JSF Updates the backing bean (fromRange and toRange) with values on the form
3) Performs the validaiton

I would really appreciate it if someone could advise me on how to do this?

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17026

I'm afraid that all that AJAX and URL parameters has kind of muddied things for me, but going back to the basic rules of JSF:

When you click a (non-AJAX) commandLink, all of the input controls of the form containing that link are marshalled and sent to the server.

In JSF, you do not update the properties and then validate. In JSF, validation occurs first. One of JSF's primary characteristics is that when an action fires, ALL of the submitted properties are already guaranteed valid and posted to the backing bean(s). If even one validation fails, the backing bean will not be updated and the action method will not fire.

Customer surveys are for companies who didn't pay proper attention to begin with.
I agree. Here's the link:
subject: Updating Backing Bean Properties using commandLink
It's not a secret anymore!