1 Reply Latest reply on Aug 2, 2008 9:18 AM by rhills

    h:selectOneMenu

      I have a class benchmarkList which contails the resultList of Benchmark objects. I have to display the list of Benchmark names(Which is is BenckMark class) in the list. When the user select one of the option from the list, the selected value should be set in the "holidayToAdd" variable of accountHome object.

      I tried it this way:

      '<a:outputPanel ajaxRendered="true">
                                    <h:panelGrid id="mypanel" columns="2" border="1">
                                         <h:selectOneMenu id="snBox" value="#{accountHome.holidayToAdd}">
                                              <s:selectItems value="#{benchmarkList.resultList}"
                                                   var="continent" label="#{continent.name}"
                                                   noSelectionLabel="Please Select..." />
                                                   <s:convertEntity />
                                                   <a:support event="onchange" ajaxSingle="true" reRender="accountBenchmarkId"/>
                                         </h:selectOneMenu>
                                         <s:button action="#{accountHome.addHolidayToAccount}" value="Add" />
                                    </h:panelGrid>
                               </a:outputPanel>'

      The problem is the method setHolidayToAdd(String holidayToAdd) of accountHome never get called so I never get the user selected value in seam component AccountHome.
      Any idea howAny idea how SelectOneMenu works when
      selectItems value is resultList of objects:
      '<s:selectItems value="#{benchmarkList.resultList}"
               var="continent" label="#{continent.name}"
               noSelectionLabel="Please Select..." />
      '
        • 1. Re: h:selectOneMenu
          rhills

          Hi Nagendra,


          I think you'll find the setter isn't being called because its parameter (String holidayToAdd) is the wrong type.


          Guessing (in the absence of your backing bean source), I'd say your setter needs to be:


            setHolidayToAdd(Benchmark holidayToAdd) {
              // do stuff with holidayToAdd...
            }
          



          HTH,