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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:24:50+00:00 2026-06-18T02:24:50+00:00

I would like to use the example from the primefaces showcase to group selectItems

  • 0

I would like to use the example from the primefaces showcase to group selectItems in selectOneMenu:

<h:outputText value="Grouping: " />  
    <p:selectOneMenu value="#{formBean.car}">  
        <f:selectItem itemLabel="Select One" itemValue="" />  
        <f:selectItems value="#{formBean.cars}" />  
    </p:selectOneMenu> 

My problem is, that there is no implementation of the bean. Now I don’t know, how to implement the grouping of the selectItems inside the method getCars(). And I can’t find any other example.

  • 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-18T02:24:51+00:00Added an answer on June 18, 2026 at 2:24 am

    The source code of the showcase’s #{formBean} is available here. Here’s an extract of relevance:

    private List<SelectItem> cars;
    
    public FormBean() {
        SelectItemGroup g1 = new SelectItemGroup("German Cars");
        g1.setSelectItems(new SelectItem[] {new SelectItem("BMW", "BMW"), new SelectItem("Mercedes", "Mercedes"), new SelectItem("Volkswagen", "Volkswagen")});
    
        SelectItemGroup g2 = new SelectItemGroup("American Cars");
        g2.setSelectItems(new SelectItem[] {new SelectItem("Chrysler", "Chrysler"), new SelectItem("GM", "GM"), new SelectItem("Ford", "Ford")});
    
        cars = new ArrayList<SelectItem>();
        cars.add(g1);
        cars.add(g2);
    }
    

    Thus, your missing key is SelectItemGroup.

    See also:

    • Our selectOneMenu wiki page – "Dynamic list with groups"
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'll use an example to explain what behaviour I would like to achieve. If
I would like to use the logout function from Django but not sure how
I would like how to use UNION ALL on CActiveDataProvider criteria . Table Example:
I would like to use some build parameters from Project 1 in Project 2.
I would like to use syslog for logging from a remote application. I have
i would like to use ajax to retrieve information from a php page that
I would like to use a Groovy closure to process data coming from a
I would like to use rfcv to cull the unimportant variables from a data
I would like to use Spring Batch as a library from Gosu. Do you
I would like to load variables from a text file. For example, my text

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.