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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:43:00+00:00 2026-05-31T22:43:00+00:00

In JSF’s tag, if you feed it using a Map<Key, Value> <h:selectOneMenu value=#{bean.integerProperty}> <f:selectItems

  • 0

In JSF’s tag, if you feed it using a Map<Key, Value>

<h:selectOneMenu value="#{bean.integerProperty}">
  <f:selectItems value="#{bean.mapProperty}"/>
</h:selectOneMenu>

The resulting HTML will be the inverse of what one would expect

<select>
  <option selected="selected" value="MapValue1">MapKey1</option>
  <option value="MapValue2">MapKey2</option>
  <option value="MapValue3">MapKey3</option>
</select>

In the sense that the map’s value will be set in the option’s value attribute and the key will be set in its label.

I found this JIRA JIRA 1808 where the implications of having to write wrong maps are explained (uniqueness, mostly), but don’t quite understand why correcting this would be

‘disruptive and backwards incompatible’.

Does this come from previous versions of JSF? If so, does anybody know if there’s a reason for it to be like this?

Just curious about if there’s an explanation not to fix this.

  • 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-31T22:43:02+00:00Added an answer on May 31, 2026 at 10:43 pm

    The initial reasoning is after all rather simple: dropdown labels have a greater precedence of to be unique than dropdown values. A dropdown with two same labels would be more a “wtf?” for the enduser than a dropdown with two same values. Map keys ensure uniqueness. I have indeed ever reported the technical unintuitiveness in the issue report which you linked yourself. However, it’s a WONTFIX. If it would be changed in JSF 2.2, it wouldn’t be backwards compatible anymore with JSF 2.0 / 2.1.

    If your environment supports EL 2.2 (Tomcat 7, Glassfish 3, etc), you can easily swap it as follows:

    <h:selectOneMenu value="#{bean.integerProperty}">
      <f:selectItems value="#{bean.mapProperty.entrySet()}" var="entry" 
         itemValue="#{entry.key}" itemLabel="#{entry.value}" />
    </h:selectOneMenu>
    

    See also:

    • Our <h:selectOneMenu> tag info page
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In JSF, I am using panelGrid which is equivalent to table in html. How
I'm using JSF 2.0 with GlassFish 3.0. I have the following Managed Bean: @ManagedBean
In JSF, I have this: <h:selectManyListbox id=createAccountBasicInfo_select_Types styleClass=selectManyCheckbox value=#{party.roles} size=6 converter=persistenceObjectToStringTwoWayConverter> <f:selectItems value=#{accTypes.selectItems} />
JSF view code: <f:view> <h:form> <h:panelGrid> <h:inputText id=key value=#{myManagedBean.key}/> <h:selectBooleanCheckbox id=rerun value=#{myManagedBean.rerun} rendered=#{myManagedBean.displayRerun}/> <h:commandButton
JSF 1.1 , using a backing bean with a nested objects inside I can
I'm using JSF/Facelets, and I'm trying to iterate over some Document objects (custom object)
JSF h:column tag fix width I tried this way, but I couldn't get this
In JSF, we can bind HtmlDataTable to backing bean and get the row data.
In JSF, h:dataTable and h:panelGrid both create html table -tags. What is the difference
I'm using a jsf array list to retrieve records based on some criteria. Now

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.