2 Replies Latest reply on Sep 11, 2007 7:49 PM by John Franey

    DataModelSelection is always the first option after 'unselec

    John Franey Novice

      I'm using jboss 4.2.1 and seam 2.0 beta1. I used seam-gen to initialize the project.

      I'm using h:selectOneMenu and s:selectItems in conjunction with @DataModel and @DataModelSelection.

      I've been banging my head on this for a while and can't understand it even now. Can anyone please shed light?

      The @DataModelSelection variable always contains the first option of the select items no matter what selection was made in the browser.

      For example, for the page source result below, no matter what the user selects, the variable marked with @DataModelSelections will ALWAYS have the value of the second option in the list ('location 1')

      <select id="masterAccountSelect:customerName" name="masterAccountSelect:customerName" size="1">
       <option value="org.jboss.seam.ui.NoSelectionConverter.noSelectionValue">Select Customer</option>
       <option value="0">(xxx) location 1</option>
       <option value="1">(yyy) location 2</option>
       <option value="2">(zzz) location 3</option>

      Here is segment of my xhtml:

       <f:facet name="header">Select Master Account</f:facet>
       <div class="dialog">
       <h:panelGrid columns="2" rowClasses="prop" columnClasses="name,value">
       <h:outputLabel for="customerName">Customer Name</h:outputLabel>
       <h:selectOneMenu id="customerName" value="#{location}">
       <s:selectItems value="#{allLocations}"
       var="loc" label="(#{loc.loginSid}) #{loc.name}" noSelectionLabel="Select Customer" />
       <h:panelGrid columns="2" rowClasses="prop" columnClasses="name,value">
       <h:outputLabel for="loginSid">Login SID</h:outputLabel>
       <h:inputText id="loginSid"
       <div class="actionButtons">
       <h:commandButton value="Select By Name" action="#{mapSubAccountsHelper1.selectLocationByName}"/>
       <div class="actionButtons">
       <h:commandButton value="Select By Login SID" action="#{mapSubAccountsHelper1.selectLocationByLoginSid}"/>

      Here is segment of my bean:

      public class MapSubAccountsHelper1 implements Serializable, MapSubAccountsHelper1Local {
       private List<Location> allLocations;
       private Location location;
       public void selectLocationByLoginSid() {
       logger.debug("selectLocationByLoginSid: " + location.getLoginSid());
       public void selectLocationByName() {
       logger.debug("selectLocationByName: " + location.getName());
       public void buildAllLocations() {

      If more information is needed, please let me know.