Hi

I have encountered this issue a couple of times, always found a way to code around but now I really need to ask:

Can struts create lists/arrays (or whatever collection) when e.g. using

public class MyAction extends ActionSupport {
      public List<Choice> getChoices() {
         ....
      }
      ....
      public List<String> getPreSelectedChoices() {
         // returns a list of Choice.getKey(), which is a String
         ....
      }
 }

 public class Choice {
     public String getKey() { ...}
     public String getDisplayName() { ... }
     ....
 }

 <ww:checkboxlist name="myChoice"
                              list="%{choices}"
                              listKey="%{'key'}"
                              listValue="%{'displayName'}"
                              value="%{preSelectedChoices}" />

The selected values are sent to

public void setMyChoice(String myChoice){
        ...
}

correct? There is no way somthing like

public void setMyChoice(String[] myChoice){
        ...
}

works in struts?

If not, whats the common way to get the values back from the String myChoice? Use Split on it?

Thank you!

Best
Fabian

Attachment: smime.p7s
Description: S/MIME Kryptografische Unterschrift

Reply via email to