File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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: 17421

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.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Updating Backing Bean Properties using commandLink
It's not a secret anymore!