| Author |
help needed on selectBooleanCheckbox
|
p kiran
Greenhorn
Joined: Sep 13, 2005
Posts: 7
|
|
Hi am new to JSF and I think its a simple problem. I have 3 check boxes like: A B C What I want is when ever I select any of the check boxes and click the submit button I want to get the value of this check box. my jsp code is simple: <TR> <TH><h:selectBooleanCheckbox value="searchBeanQuery.iLinkSelected" immediate="true"/> <h utputText value="ILINK"/></TH> <TH><h:selectBooleanCheckbox value="searchBeanQuery.hipHopSelected" immediate="true"/> <h utputText value="HIPHOP"/></TH> <TH><h:selectBooleanCheckbox value="searchBeanQuery.falconSelected" immediate="true"/> <h utputText value="FALCON"/></TH> </TR> let me know. wiating for responses
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
|
Well, your backing bean should have boolean members for each checkbox in your JSF page with appropriate getters and setters for the value. What exactly don't you understand how to do? What have you tried? Where is your managed bean code?
|
 |
p kiran
Greenhorn
Joined: Sep 13, 2005
Posts: 7
|
|
here is my bean code public boolean getFalconSelected() { return falconSelected; } public void setFalconSelected(boolean falconSelected) { System.out.println("FALCON Checked"); this.falconSelected = falconSelected; } public boolean getHipHopSelected() { return hipHopSelected; } public void setHipHopSelected(boolean hipHopSelected) { System.out.println("HIPHOP Checked"); this.hipHopSelected = hipHopSelected; } public boolean getILinkSelected() { return iLinkSelected; } public void setILinkSelected(boolean linkSelected) { System.out.println("ILINK Checked"); iLinkSelected = linkSelected; }
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
Well, that's "part" of your backing bean. Care to show the whole thing? And can you use Code Tags this time? Be more specific on what you want to do. Yes, you want to get the value of the selected checkbox, so when your button is clicked determine which one is set to true.
|
 |
p kiran
Greenhorn
Joined: Sep 13, 2005
Posts: 7
|
|
I got it the problem was simple. I specified the value ="searchBeanQuery.ilSelected" instead of value="#{searchBeanQuery.ilSelected}" thanks
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
You might want to read this a little bit. Obviously it was something easy but the way you worded your question wasn't "I am getting an error..." or "when I try this it doesn work...". You worded it as "how do I..." which would imply to me that you just didn't know how. Not that you were having a problem with what you were doing specifically. It helps everyone to asked the right kinds of questions. Glad you got it figured out.
|
 |
p kiran
Greenhorn
Joined: Sep 13, 2005
Posts: 7
|
|
yeah sorry, I wen tthru the tutorial then I found the solution. I dint know anything about that thats the reason I asked the question i that way. anyway sorry for misunderstanding.
|
 |
 |
|
|
subject: help needed on selectBooleanCheckbox
|
|
|