Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

h selectBooleanCheckbox valueChangeListener not working properly

 
Kumar Gaurav
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Stefan Evans
Bartender
Posts: 1784
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic