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

  • SEARCH
  • Home
  • 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 6348467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:25:29+00:00 2026-05-24T21:25:29+00:00

I found a tutorial that is very close to what I am looking to

  • 0

I found a tutorial that is very close to what I am looking to do: http://www.andygibson.net/blog/tutorial/binding-dynamic-multi-select-checkboxes-with-jsf/

The only change is that I am building my checkboxes within my backing bean instead of in my .xhtml file, but the ‘value’ attributes are not being set correctly.

snippet from my .xhtml file:

<h:form>
<h:panelGrid binding="#{myBean.myGrid}"></h:panelGrid>
<h:commandButton id="submit" type="submit">
</h:form>

snippet from myBean:

public HtmlPanelGrid getMyGrid()
{
  resultGrid = new HtmlPanelGrid();
  resultGrid.setColumns(2)
  List children = resultGrid.getChildren();

  FacesContext myFacesInstance = FacesContext.getCurrentInstance();
  Application myApp = myFacesInstance.getApplication();
  ExpressionFactory expFactory = myApp.getExpressionFactory();

  SelectItem tempSelectItem;
  String valuStringExpression;
  ValueExpression valExpression;

  //create panel for the checkboxes
  HtmlSelectManyCheckbox checkboxPanel = new HtmlSelectManyCheckbox();
  checkboxPanel.setLayout("pageDirection");

   List<SelectItem> checkChoiceList = new ArrayList<SelectItem>();

   for (int i=0;i<numChoices;i++)
   {
    valStringExpression = "#{myBean.responseValue["+i+"]}";
valExpression = expFactory.createValueExpression(myFacesInstance.getELContext(), valStringExpression, String.class);        
    tempSelectItem = new SelectItem(valExpression,choiceLabels.get(i));
    checkChoiceList.add(tempSelectItem);
   }

  UISelectItems checkboxList = new UISelectItems();
  checkboxList.setValue(checkChoiceList);
  checkboxPanel.getChildren().add(checkboxList);

  children.add(checkboxPanel);

return resultGrid;
}

The problem is that each checkbox’s value attribute is not properly mapping to my “#{myBean.responseValue[“+i+”]}” properly.

If I pull up ‘View Source” from the web page, the checkbox tag’s value shows up as:

value="ValueExpression[#{myBean.responseValue[0]}]"

I have been googling for hours upon hours and I am stumped. Any help or ideas are greatly appreciated!!

  • 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-24T21:25:30+00:00Added an answer on May 24, 2026 at 9:25 pm

    The 1st argument of the SelectItem constructor expects the actual select item value, not some value expression. Fix it accordingly:

    Object value = valExpression.getValue(elContext);
    tempSelectItem = new SelectItem(value, choiceLabels.get(i));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running through this tutorial found here: http://vb.net-informations.com/crystal-report/vb.net_crystal_report_from_multiple_tables.htm which teaches how to pass a
I've been looking at the code in this tutorial , and I found that
I found a tutorial online that extends that Apple QuickStart Application which is the
I have just found this great tutorial as it is something that I need.
From the Jobeet tutorial provided in Symfony website, I found out that I can
So I found this: http://tiles.apache.org/framework/tutorial/advanced/nesting-extending.html Here is the example: <definition name=myapp.homepage template=/layouts/classic.jsp> <put-attribute name=title
I've found I think very good tutorial on how to compile gcc on windows
I found a tutorial to do syntax highlighting in RichEdits for WPF: http://blogs.microsoft.co.il/blogs/tamir/archive/2006/12/14/RichTextBox-syntax-highlighting.aspx But
I am very new to XNA and I began by following a tutorial that
I am having an issue with parsing the following website: http://www.x-rates.com/d/USD/table.html I am very,

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.