[Opensource] How to deal with multiple values from inputs

Michael Rimov rimovm at centercomp.com
Sat Jun 29 05:23:13 PDT 2002


At 03:41 PM 6/27/2002 -0600, you wrote:
>I have an array of checkboxes.  Normally, I would name them all the same 
>thing, give them different values and collect the values using 
>HttpServletRequest.getParameterValues() which returns a String[].
>
>First question:  Is there an easy way to do this with 
>expresso?  Currently, I'm using a hacky workaround:
>
>ServletControllerRequest sr = ( ServletControllerRequest ) request;
>         HttpServletRequest hreq = ( HttpServletRequest ) 
> sr.getServletRequest();
>         String[] fileTypes = hreq.getParameterValues("fileTypeInput");

Nope!  That's the proper workaround.  It was definitely a ControllerRequest 
oversight in the design, but I haven't gotten around to fixing it.  It is 
definitely on the todo list, however.

>Second question:  Is there a way to get this String[] into my DBObject (or 
>MultiDBObject) so that I can run a query on it?  setField only accepts a 
>String value.  If there isn't a way to get this in there so the SQL looks 
>like "WHERE FILE_TYPE IN (myString[])" so I can query my table on this?

There is a DBOBject.setCustomWhereClause() that you can use to build your 
own special conditions.  Check out JobHandler for an example of this in action.

HTH!
                                                 -Mike




More information about the Opensource mailing list