File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Updating Backing Bean Properties using commandLink

 
Darren Carter
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 17616
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic