Also, I believe that the build in XWork converters support turning String[] -> List. Just a slightly nicer format. :)
-Pat ----- Original Message ----- From: "Bernard Choi" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, September 17, 2003 2:38 AM Subject: Re: [OS-webwork] How to get values from multiple select > public class MyAction extends ActionSupport { > > private String[] multi; > > protected void doValidation() { > if (multi == null) { > addFieldError("multi", "no options selected."); > } > } > > public String doExecute() { > for (int i = 0; i < multi.length; i++) { > String option = multi[i]; > > } > return super.SUCCESS; > } > > public String[] getMulti() { > return multi; > } > > public void setMulti(String[] multi) { > this.multi = multi; > } > } > > > ... > > The above works for checkboxes as well. > > >Hello, > > > >I've got a problem. How can I get the value from multiple select? I've got > >following code in template.vm: > > > ><select name="multi" size="5" multiple> > > > ><option value="1">One > > > ><option value="2">Two > > > ><option value="3">Three > > > ><option value="4">Four > > > ><option value="5">Five > > > ></select> > > > >Now I need the set/get method. Which Java type should I use for 'multi'? > > > >Thanks in advance > >Tomasz Wrona > > > > > > > >------------------------------------------------------- > >This sf.net email is sponsored by:ThinkGeek > >Welcome to geek heaven. > >http://thinkgeek.com/sf > >_______________________________________________ > >Opensymphony-webwork mailing list > >[EMAIL PROTECTED] > >https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Opensymphony-webwork mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork