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 help needed on selectBooleanCheckbox 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 "help needed on selectBooleanCheckbox " Watch "help needed on selectBooleanCheckbox " New topic
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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: help needed on selectBooleanCheckbox
 
Similar Threads
Please HELP me. How To Hard Code Values in Each Row of a dataTable?
Model update problem
MyFaces CollapsibelPanel Problem
Centering a checkbox in a h:dataTable column
Problem with tomahawk Tree Table