You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Luke Majewski <lu...@verizon.net> on 2003/03/28 04:14:22 UTC

multiple select list

I'm having some trouble getting started using a multiple select list widget of the form

    <select multiple size=6 name=resourceLanguageId[]> 

        #foreach ($lang in $languages) 
            <option value="$lang.id"  
            #if ($lang.flag) selected #end
        >$lang.name
        #end

    </select>

I am stuck trying to figure out where to go from here, displaying the items is fine, but I'm not sure how to pass the information about which items are selected to my java code.  Can anyone point me the right direction?

Thank you,

Luke Majewski
Center for Promotion of Child Development Through Primary Care

Re: multiple select list

Posted by Martin Jacobson <ma...@libero.it>.
Luke Majewski wrote:
> I'm having some trouble getting started using a multiple select list widget of the form
> 
>     <select multiple size=6 name=resourceLanguageId[]>         #foreach ($lang in $languages) 
>             <option value="$lang.id"  
>             #if ($lang.flag) selected #end
>         >$lang.name
>         #end
> 
>     </select>
> 
> I am stuck trying to figure out where to go from here, displaying the items is fine, but I'm not sure how to pass the information about which items are selected to my java code.  Can anyone point me the right direction?
> 
> Thank you,
> 
> Luke Majewski
> Center for Promotion of Child Development Through Primary Care

Not a velocity question, but assuming you are POSTing to a servlet, then 
you have an HttpServletRequest - lets call it req.

do the following:

     String[] langIds = req.getParameterValues("resourceLanguageId[]");

the selected ids are in the array. Easy!

HTH,

Martin


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: multiple select list

Posted by Claude Brisson <cl...@savoirweb.com>.
not really a velocity question...

If you are using a framework like Struts or Turbine, you should rather post your question to the corresponding list.

CloD

----- Original Message -----
From: "Luke Majewski" <lu...@verizon.net>
To: <ve...@jakarta.apache.org>
Sent: vendredi 28 mars 2003 04:14
Subject: multiple select list


I'm having some trouble getting started using a multiple select list widget of the form

    <select multiple size=6 name=resourceLanguageId[]>

        #foreach ($lang in $languages)
            <option value="$lang.id"
            #if ($lang.flag) selected #end
        >$lang.name
        #end

    </select>

I am stuck trying to figure out where to go from here, displaying the items is fine, but I'm not sure how to pass the information
about which items are selected to my java code.  Can anyone point me the right direction?

Thank you,

Luke Majewski
Center for Promotion of Child Development Through Primary Care


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org