[jboss-user] [JBoss Portal] - wrong selected in selectOneMenu for portal-identity

sannegrinovero do-not-reply at jboss.com
Tue Dec 2 11:28:18 EST 2008

I've been following the reference guide to add new internationalized properties to identity-ui-configuration.xml:

<ui-component name="typeofcustomer">
  |    <property-ref>portal.user.typeofcustomer</property-ref>
  |    <values>
  |       <value key="xi">individual</value>
  |       <value key="xc">company</value>
  |    </values>
  |    <required>true</required>
  | </ui-component>
and in the view:

<h:selectOneMenu id="typeofcustomer" value="#{manager.uiUser.attribute.typeofcustomer}" required="#{metadataservice.typeofcustomer.required}">
  |    <f:selectItems value="#{metadataservice.typeofcustomer.values}" />
  | </h:selectOneMenu>
  | <h:outputText value="DEBUG: #{manager.uiUser.attribute.typeofcustomer}"/>

This code works correctly the first time, and correctly updates the values, but when using the page to update the information for an existing user it always shows the first option of the generated .
Using the DEBUG line you see in the view code I've discovered that the value it's showing is not the option key, but the localized value:
It prints "Company" when the correct value is Company (bundle key=XC), but the selectOne menu is showing "Individual" because it's the first in the list.

This behaviour is nice of course for when I have to "show" the value only using the outputText, but breaks all selectOnes!
My current workaround is to not localize this value, and use key==shown value.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4193785#4193785

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4193785

More information about the jboss-user mailing list