0 Replies Latest reply on Dec 3, 2009 7:13 PM by chwang.chaohua_wang.yahoo.com

    How to use HashMap in <s:selectItems> ?

    chwang.chaohua_wang.yahoo.com
      Hi Folks,

      I have a eamilBean, this is a javebean.
      it has an arrtibute:

      public HashMap<String, Boolean> getTaskTypes(){
                 return this.taskTypes;
      }
           
      public void setTaskTypes(HashMap<String, Boolean> taskTypes){
                 this.taskTypes = taskTypes;
                
      }

      I have another calls file called: EmailManagerAction.java.
      which has a method:
      public HashMap<String, Boolean> getTaskTypes()


      The following is part of email.jsp file.

               <h:selectManyCheckbox
                           id="taskTypes"
                            layout="pageDirection"
                            value="#{emailBean.taskTypes}">          
                       <s:selectItems value="#{emailManager.taskTypes}"  var="i" label="#{i}"/>
                </h:selectManyCheckbox>
           <h:messages/>

      But when submit acction:

      I got this error message:

      sourceId=em:taskTypes[severity=(ERROR 2), summary=(Conversion Error setting value 'true' for '#{emailBean.taskTypes}'. ), detail=(Conversion Error setting value 'true true' for '#{emailBean.taskT
      ypes}'. )]

      I am not sure reason why, do i need to do some convert?

      Please help, Thank you very much

      Chwang