aspose file tools*
The moose likes JSF and the fly likes h selectBooleanCheckbox  valueChangeListener not working properly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "h selectBooleanCheckbox  valueChangeListener not working properly" Watch "h selectBooleanCheckbox  valueChangeListener not working properly" New topic
Author

h selectBooleanCheckbox valueChangeListener not working properly

Kumar Gaurav
Ranch Hand

Joined: Apr 08, 2008
Posts: 108
Hi All,

I am using a selectBooleanCheckBox. Initially it is deselected. When i select it for the first time it is getting selected and valueChnageListener is getting executed. Again if i am trying to deselect it, neither it is getting deselected not valueChangeListener is getting executed. Below is the code.

Any pointer why it is not working.


Regards,
Gaurav
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
First suggestion: when posting code use \[code] tags. There is even a button for it.
It makes the code much easier to read - see?

Second suggestion: JSTL and JSF don't really play that well together according to my understanding.
I would avoid mixing them (though my experience with JSF and JSTL is years out of date, so that may have changed)

On one path through the code, you render the component with a value change listener.
On the other path you don't?
Maybe that path is being executed?

Rather than having two different ways of declaring these components, I would rather declare the controls once, and deal with the check in the listener.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16141
    
  21

Stefan Evans wrote:
Second suggestion: JSTL and JSF don't really play that well together according to my understanding.
I would avoid mixing them (though my experience with JSF and JSTL is years out of date, so that may have changed)


It used to be that mixing JSTL and JSF was an unmitigated disaster, but as JSF matured, it merely became asking for trouble. Extra trouble when AJAX is involved.

For the most part, there's NOTHING in JSTL that JSF can't handle using pure JSF, and do so more cleanly. I've never ever found it necessary to put JSTL on a JSF View definition.

And in particular, using logic constructs (loops and conditions) on a JSF View breaks the MVC contract that says logic goes in Controllers, not in the View. If you want a tabular display in JSF, use the DataTable control. If you need conditional rendering of components, use the "rendered=" attribute.


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: h selectBooleanCheckbox valueChangeListener not working properly