> > Multiple selects return an array of strings so your form bean should have a 
> > String[] multiSelect member with accessors:
> > String[] getMultiSelect()
> > void setMultiSelect(String[])
> 
> Right, but if the method get() is defined as
> 
> public Object get()
> 
> then how do you do
> 
> String[] mySelect = form.get("mySelect");
> 
> ???  The compiler won't accept it.
> 
> Note that I have no form class and I am just using the get() and
> set() methods from the DynaValidatorActionForm

After a bit more research I noticed the toString() method for the
DynaValidatorActionForm class and by examining that I see that you
can work with an array like:

 Object value = form.get("mySelect");
 if (value.getClass().isArray())
 {
     int len = Array.getLength(value);
     if (int j = 0; j < len; j++)
     {
         System.out.println(Array.get(value, j));
     }
 }
 ... (similar for List and Map)

But how do I know when it is an array, a list or a Map as all of
those types are considered in the toString() method.

Assume my form is like

 <select name="mySelect">
     <option value="0">first</option>
     <option value="1">second</option>
 </select>

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <[EMAIL PROTECTED]>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
It is not enough to succeed.  Others must fail.  
 -- Gore Vidal
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to