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 8710349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:36:25+00:00 2026-06-13T04:36:25+00:00

I have a question about selectOneMenu and settting the values. I have an Object

  • 0

I have a question about selectOneMenu and settting the values. I have an Object SampleDesc that has and ID, Text, and a List<SampleDescValues>. For each datatable row the Text is the output label and the select one menu values are the List<SampleDescValues>.
XHTML:

    <h:panelGroup id="tables">
    <p:dataTable resizableColumns="true" 
             var="sampleDesc" id="SampleDescTable" rowIndexVar="rowIndex"
                     value="#{sampleBean.sampleDescList.list}" 
                     rendered="#{sampleBean.sampleDescList.list.size() gt 0}">
            <p:column>
                    <h:outputLabel value="#{sampleDesc.sampleDescText}"/>
                </p:column>
        <p:column>
            <h:selectOneMenu required="#{sampleBean.sampleDescList.list.size() gt 0}" converter="#{sampleDescValueConverter}" 
                                                         id="SampleDescValue" value="#{sampleBean.selectedSampleDescList.get(rowIndex)}">                                                         
                <f:selectItem itemLabel="Select One" itemValue="#{null}"/>
                            <f:selectItems value="#{sampleDesc.sampleDescValues}" var="sdv" 
                                       itemLabel="#{sdv.sampleDescValuesText}" itemValue="#{sdv}" />

                        </h:selectOneMenu>
                </p:column>    
        </p:dataTable>
</h:panelGroup>   

I have the converter setup and it works because ive set it to a single SampleDescValue and it set the value.

The problem is when i try and populate the form with a Sample from the database it can only set one of the dropdowns when there could be an infinite number of selectonemenu’s

I set the value selected to private List<SampleDescValue> selectedSampleDescList;

When i try and submit it does nothing, it works when the datatable is not rendered.

  • 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-06-13T04:36:27+00:00Added an answer on June 13, 2026 at 4:36 am

    Your menu value is wrong:

    <h:selectOneMenu value="#{sampleBean.selectedSampleDescList.get(rowIndex)}">
    

    It’s not possible to perform a set operation on this EL expression.

    Use the brace notation instead:

    <h:selectOneMenu value="#{sampleBean.selectedSampleDescList[rowIndex]}">
    

    Note that this expects a non-null selectedSampleDescList. So make sure that you’ve already properly initialized it with a new ArrayList<>() beforehand. EL won’t do that for you. It will only set the list items using List#add(index, object) method.

    See also:

    • Our EL wiki page

    Unrelated to the concrete problem, this expression

    #{sampleBean.sampleDescList.list.size() gt 0}
    

    can be simplified as follows

    #{not empty sampleBean.sampleDescList.list}
    

    And this is unnecessary in the required attribute of the <h:selectOneMenu> as it would always evaluate true at that point. Just use required="true" directly instead.

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

Sidebar

Related Questions

I have question about pointers in C. Each pointer has 4 bytes in memory
I have a question about SqlDataReader: Is there some way to modificated the values
I have question about database optimizing, indexing. I have table that called projects and
i have a question about fopen() and base64 comunication. The scenario is that: i
i have question about two different Bundle object in below methods : onSaveInstanceState(Bundle outState);
i have question about finding maximum x or y-value in text file. This is
https://stackoverflow.com/a/64983/468251 - Hello, I have question about this code, how made that working with
I have question about parsing in Html helper : I have sth like: @foreach
I have question about clean thory in Python. When: @decorator_func def func(bla, alba): pass
I have question about XSLT1.0. The task is to write out in HTML all

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.