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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:04:04+00:00 2026-06-13T17:04:04+00:00

I have a <p:selectManyCheckbox> inside <ui:repeat> , getting it’s items from a List of

  • 0

I have a <p:selectManyCheckbox> inside <ui:repeat>, getting it’s items from a List of a certain Object Class (provided by <ui:repeat>-variable) and is supposed to save the chosen items into another List of the same Object Class. But it calls the setter method #{cartBean.setSelectedExtras} only for the last entry (last iteration of <ui:repeat>).

<ui:repeat var="item" value="#{category.items}">
    <p:selectManyCheckbox id="extraCheckbox" value="#{cartBean.selectedExtras}" layout="pageDirection" converter="omnifaces.SelectItemsConverter">  
         <f:selectItems value="#{item.items5}" var="extra" itemLabel="#{extra.name}"/>
    </p:selectManyCheckbox>
</ui:repeat>

Update:
I changed the above construct just the way BalusC proposed.
Declaration in backing bean is now:

private List<List<Item>>  selectedExtras   = new ArrayList<List<Item>>();

When I check checkboxes that were created by the first loops of <ui:repeat> and click the <p:commandButton> inside the same <h:form> the setter method of selectedExtras is not called. When I check the checkboxes created in the last loop of <ui:repeat> and click the <p:commandButton> I get an Exception:

javax.el.PropertyNotFoundException: /lightbox-item.xhtml @57,165 value="#{cartBean.selectedExtras[iteration.index]}": null
  • 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-13T17:04:05+00:00Added an answer on June 13, 2026 at 5:04 pm

    This construct works fine for me.

    As mentioned in among others the showcase page, the omnifaces.SelectItemsConverter uses by default the toString() representation of the complex object as converted item value. So if you didn’t override the toString() method (so that it still defaults to com.example.SomeClass@hashcode which changes on every instantiation) and the #{item} managed bean is request scoped, then the list would basically be changing on every HTTP request. This would cause a “Validation Error: Value is not valid” error.

    If you add

    <p:messages autoUpdate="true" />
    

    or

    <p:growl autoUpdate="true" />
    

    so that you get all (missing) validation/conversion messages in the UI, then you should have noticed it.

    In order to utilize the omnifaces.SelectItemsConverter at its best, you should override the toString() method accordingly so that it returns a fixed and unique representation of the complex object. E.g.

    @Override
    public String toString() {
        return "Extra[id=" + id + "]";
    }
    

    Alternatively, you could put the #{item} managed bean in a broader scope, such as the view scope.


    Update as to your update, you’re binding the selected values of all checkboxgroups to one and same bean property #{cartBean.selectedExtras}. This way every iteration overrides the property with the values from the current iteration round as long as until you end up with the values of the last iteration. If you’ve placed a debug breakpoint on the setter, you’d have noticed that.

    This is not right. They should each point to a different bean property. Technically, you should have a #{item.selectedExtras} as property. But I think that this makes no sense in your current design. Better would be to make the #{cartBean.selectedExtras} an List<Item[]> or Item[][]. This way you can get them to set based on the iteration index as follows:

    <ui:repeat var="item" value="#{category.items}" varStatus="iteration">
        <p:selectManyCheckbox id="extraCheckbox" value="#{cartBean.selectedExtras[iteration.index]}" layout="pageDirection" converter="omnifaces.SelectItemsConverter">  
             <f:selectItems value="#{item.items5}" var="extra" itemLabel="#{extra.name}"/>
        </p:selectManyCheckbox>
    </ui:repeat>
    

    In case of List<Item[]> you only need to make sure that you preinitialize selectedExtras with nulls as many times as there are #{category.items} in bean’s (post)constructor.

    for (Item item : category.getItems()) {
        selectedExtras.add(null);
    }
    

    In case of Item[][], you can suffice with

    selectedExtras = new Item[category.getItems().size()];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

have written this little class, which generates a UUID every time an object of
I have a selectManyCheckbox component. categories is an array list of selectItems that I
Have 2 tables in Access 2007, both lists of certain tasks to be accomplished.
have a nice day. I got problem when trying to create an image from
I have a JSF page. At one point, I have a <h:selectManyCheckbox> that is
Have a photography site that I want to prevent image copying from. How can
Have created a ATL COM project through which I am inserting Menu Items to
I have a <h:selectManyCheckbox> and they have in the HTML source an autogenerated name
Have one Doubt In MVC Architecture we can able to pass data from Controller
We have this ui:repeat: <ui:repeat value=#{notAssigned} var=pair> #{pair.data.processName}<br/> <s:button value=assign action=#{mypage.assign}> <f:param name=taskId value=#{pair.task.id}/>

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.