File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes can't get selectManyCheckbox values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "can Watch "can New topic

can't get selectManyCheckbox values

marwa talaat

Joined: Dec 28, 2011
Posts: 2
i'm a newbie in JSF1.2 and it is my first task.
when i select many checkbox in jsf page the result jsf page doesn't view checkboxs values

this is my code

<h:column>Favorite Hobbies</h:column>
<f:selectItem itemValue="Reading" itemLabel="Reading"/>
<f:selectItem itemValue="Swiming" itemLabel="Swiming"/>
<f:selectItem itemValue="Watching TV" itemLabel="Watching TV"/>

<h:commandButton value="Register Now" action="submit"></h:commandButton>

package com.jsf.model;
import java.util.HashMap;
import java.util.Map;

public class AddCustomer {
private Map<String,String>favorite;

public Map<String, String> getFavorite() {
favorite= new HashMap<String, String>();
favorite.put("Watching TV","Watching TV");
return favorite;
public void setFavorite(Map<String, String> favorite) {
this.favorite= favorite;

<c:forEach items="#{addCustomer.favorite}" var="fav">
<hutputText value="#{fav}"/>



Louis Bros
Ranch Hand

Joined: Jun 03, 2011
Posts: 54

Won't your checkbox be needing a value referencing a corresponding setter method in your bean?

I'm just curious, since you're learning JSF why don't you start with JSF 2.0?

rose holcomb

Joined: Dec 28, 2011
Posts: 1
review every line you input. in order to stop spelling errors. programming is very sensitive.
Consider Paul's rocket mass heater.
subject: can't get selectManyCheckbox values
jQuery in Action, 3rd edition