This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JSF and the fly likes How to change check box state Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "How to change check box state" Watch "How to change check box state" New topic
Author

How to change check box state

Priya Joshi
Greenhorn

Joined: Feb 24, 2008
Posts: 8
Hi,

I am very new to JSF.
I am facing one problem, I want to change the state of check box (want to uncheckd it).
Even though I am setting value to false but its not working, it is getting its state from the root view.
Below is the simle jsf code i am using and setting employer field's value in controller as false.
I debuge it the value is changing for the field but when it start executing JSF stuff and its value reset to true.

<html:selectBooleanCheckbox id="employerAndIncomeID" value="#{PersonBSO.employer}" />

I struggling with this. If anybody tell me how to change a JSF components value programatically will be great help for me.



Thanks and Regards,
Priya
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14487
    
    7

That's not enough to actually indicate what the problem is. My guess is that your backing bean is in request scope and it's getting destroyed and recreated on each page request. It would need to be in session scope to avoid that.

Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to change check box state
 
Similar Threads
How to setup a single checkbox to toggle / untoggle other check boxes?
how jsf component get the value from backing bean instead of submitted value after validation error
javascript value to JSF
checkbox in jsp
Value status of check box in java