Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 952499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:54:11+00:00 2026-05-15T23:54:11+00:00

if i want to bind the value-attribute of a h:selectmanycheckbox to a map, with

  • 0

if i want to bind the value-attribute of a h:selectmanycheckbox to a map, with the ri of the jsf 2.0.3 i would do something like the following

the bean:

private Map<String, String[]> values = new HashMap<String, String[]>();

public Map<String, String[]> getValues() {
    return values;
}

public void setValues(Map<String, String[]> values) {
    this.values = values;
}

and the xhtml page:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core">
<h:head>
    <title>Facelet Title</title>
</h:head>
<h:body>

    <h:form>
        <h:selectManyCheckbox
            id="test"
            value="#{testController.values['foo']}">
                <f:selectItem itemLabel="1" itemValue="1_1" />
                <f:selectItem itemLabel="2" itemValue="1_2" />
                <f:selectItem itemLabel="3" itemValue="1_3" />
                <f:selectItem itemLabel="4" itemValue="1_4" />                    
        </h:selectManyCheckbox>           
        <h:commandButton value="Send" />

    </h:form>

</h:body>

This works fine, but in my application I need more control over the location of every single checkbox, so i replaced the standard <h:selectManyCheckbox> tags with their icefaces-equivalent <ice:selectManyCheckbox> and the <ice:checkbox>.
The bean stays the same and the xhtml-page now looks like that:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:ice="http://www.icesoft.com/icefaces/component"
  xmlns:f="http://java.sun.com/jsf/core">
<h:head>
    <title>Facelet Title</title>
</h:head>
<h:body>
    <h:form>
        <ice:selectManyCheckbox
            id="test"
            layout="spread"
            value="#{testController.values['foo']}">
                <f:selectItem itemLabel="1" itemValue="1_1" />
                <f:selectItem itemLabel="2" itemValue="1_2" />
                <f:selectItem itemLabel="3" itemValue="1_3" />
                <f:selectItem itemLabel="4" itemValue="1_4" />                    
        </ice:selectManyCheckbox>           
        <table border="1">
            <tr>
                <td><ice:checkbox id="c1" for="test" index="0" /></td>
                <td><ice:checkbox id="c2" for="test" index="1" /></td>
            </tr>
            <tr>
                <td><ice:checkbox id="c3" for="test" index="2" /></td>
                <td><ice:checkbox id="c4" for="test" index="3" /></td>
            </tr>
        </table>
        <h:commandButton value="Senden" />            
    </h:form>

</h:body>

Now whenever I send the form I get a conversion-error and I can’t figure out why.

If I bind the <ice:selectManyCheckbox>‘s value-attribute to a simple stringarray it forks fine, but because I don’t know how many checkbox-groups there will be I need it to work with a map.

I use the icefaces 2.0.0 beta 1 together with the sun ri 2.0.3 and the el 2.2 on tomcat 6.0.26.

Does anybody know a solution to my problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T23:54:12+00:00Added an answer on May 15, 2026 at 11:54 pm

    You can try to put as many dummy mapelemts as you need to “initialize” your map.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to bind a string value to a text box but only if
I want to bind to a value in a dictionary property of an object.
I want to load key/values configuration pairs stored in XML file. To bind a
I want to bind a button's width to some textbox's text value, although I
I have a control (let's say a textbox) and I want bind the value
I want to bind a function to an event but I want to change
I want to bind Groupboxes to my stackpanel. c#: internal ObservableCollection<GroupBox> BindingTest { get
I want to bind my ListView control to a generic list of objects? I
I want to bind Ctrl-Alt-N to an External Tool (Nant build) in SharpDevelop, how
I want to bind an event to a certain class and ID for when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.