You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "A. Lotfi" <ma...@yahoo.com> on 2008/10/16 15:01:22 UTC

How to populate comboboxes from Database ??

Hi,
   
  I am using struts1.2
   
  I need to have a jsp page that has a form with two comboboxes or listboxes and a submit button, so the user can transfer data between the two comboboxes and the press submit button to update the database.
   
  is there any small example on how to get data from Database to a list box in a jsp page ?
   
  Thanks, your help is appreciated.
   
   

       

Re: how to transfer element between two list boxes ?

Posted by Dave Newton <ne...@yahoo.com>.
--- On Fri, 10/17/08, A. Lotfi wrote:
> <html:form action="transfertoDB">
>   <html:select property="menu" size="10" >
>     <html:option value="">--SELECT--</html:option>
>     <html:options collection="menuList1" property="value"
>                   labelProperty="label" />
> [...]
>
>   I have two questions :
>   1) I hard coded the size of the lists to 10,How to make
> the size dynamic?

Use JSP EL:

<html:select property="menu" size="${theSize}">

> 2) I would like to transfer element between the two lists.

Not a Struts question; that's JavaScript.

Dave


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


how to transfer element between two list boxes ?

Posted by "A. Lotfi" <ma...@yahoo.com>.
Hi,
   
  I am using struts1.2.9
   
  I have a jsp file that has two list boxes :
   
  <html:form action="transfertoDB">
            <html:select property="menu" size="10" >
                <html:option value="">--SELECT--</html:option>
                <html:options collection="menuList1" property="value" labelProperty="label" />
            </html:select>  
           
            <html:select property="menu" size="10" >
                <html:option value="">--SELECT--</html:option>
                <html:options collection="menuList2" property="value" labelProperty="label" />
            </html:select>  
        </html:form>
   
  I have two questions :
  1) I hard coded the size of the lists to 10,How to make the size dynamic?
   
  2) I would like to transfer element between the two lists .
   
  Thank you , your help is appreciated.

 __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com