It's not a secret anymore!
The moose likes JSF and the fly likes Setting Values for Bean Properties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Setting Values for Bean Properties" Watch "Setting Values for Bean Properties" New topic

Setting Values for Bean Properties

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1543
Surly I am not understanding the use of managed bean properties from my JSF. As it stands right now I have to have a physical control on the JSF with the value set to the managed bean property so when a submit is done the value of the input control drives the bean property value.

I have also noticed that the input controls have to be in a certian order for the submit to work. Seems that at least the last setter property has to match the last input control managed bean.

Is there a way to do this with out having the input control on the form?

Example: I have a bean that does remote updates to a particular record in a database. This update is indexed on a recseq number. To make this work from the JSF the recseq has to be a managed bean. However, I really don't want to have to display the recseq on the user form.
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17271

Usually Ids are passed as request parameters. But you still need the UIComponents on the JSF page to have a value="#{}" to a property in a managed bean if you the managed bean to have the values that were entered on the page's form.


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1543
What if just need the managed bean to have a pre-determined value? Say a session attribute value. Can I set the bean property with JavaScript when I load the JSF?
I agree. Here's the link:
subject: Setting Values for Bean Properties
jQuery in Action, 3rd edition