3 Replies Latest reply on Mar 8, 2009 10:24 PM by tariqahsan

    Help for using selectOneMenu

    tariqahsan
      Hello All!

      I am Seam newbie trying to use selectOneMenu to create a simple drop down menu on a page. Not sure if I am doing everything correctly. Anyway here's the codes I have so far -

      part of the my jpdl.xml file -
      `
      ...
      <decision name="UserDecision" expression="#{mybean.actionindicator}" >
             <transition name="A" to="createEval" />
             <transition name="C" to="updateEval" />
             <transition name="D" to="deleteEval" />
         </decision>
         <decision name="createEval" expression="#{mybean.create()}" >
                 <transition name="abortOperation" to="return" />
             <transition name="success" to="MyResponse" />
             <transition name="failure" to="start" /   </decision>
      ...
      `
      part of MyBean.java -
      `
      ...

      public String getActionindicator() {
                return this.actionindicator;
           }

      public void setActionindicator(String actionindicator) {
                this.actionindicator = actionindicator;
           }

      ...
      `
      and here's the content of the xhtml file -
      `
      <h:selectOneMenu id="actionindicator" value="#{mybean.list}">
                          <s:convertEnum />
                           <s:enumItem enumValue="ONCE" label="Only Once" />
                           <s:enumItem enumValue="EVERY_MINUTE" label="Every Minute" />
                           <s:enumItem enumValue="HOURLY"       label="Every Hour" />                   
                    </h:selectOneMenu>

      ...
      `
      Getting this error -
      java.lang.IllegalArgumentException: java.lang.String is not an enum type

      Though I am trying out using enumItem would like to know how I can use selectItem also.

      Thanking you for your help.

        • 1. Re: Help for using selectOneMenu
          tariqahsan
          Sorry, here's correct xhtml file content -

          <h:selectOneMenu id="actionindicator" value="#{mybean.actionindicator}">
          <s:convertEnum />
          <s:enumItem enumValue="C" label="C" />
          <s:enumItem enumValue="A" label="A" />
          <s:enumItem enumValue="D" label="D" />              
          </h:selectOneMenu>
          • 2. Re: Help for using selectOneMenu
            joblini

            Does a selectMenu support nesting of enumItem as shown?  Shouldn't it be a selectItem rather that an enumItem?

            • 3. Re: Help for using selectOneMenu
              tariqahsan
              Was not fully sure if I could use s:enumList. The tutorial has an example of using for selectOneRadio. Thought could use it for selectOneMenu also. Would you have any sample codes especially for the backend java bean? Would something like below with some correction for the xhtml work?

              <h:selectOneMenu id="actionindicator" value="#{mybean.list}">
              <s:selectItems value="#{mybean.list}" />
              <s:convertEnum />
              </h:selectOneMenu>

              Thanks