You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Wendy Smoak <We...@asu.edu> on 2003/06/13 18:02:27 UTC

RE: get the selected values from list box

> I have a List box in jsp file, 

Is a List box an HTML <select> that allows multiple selections?

> and I try to delete only selected values. 
> Could you please tell me how to
> get the selected values, 

What does the corresponding Form bean property look like?  I don't have any
multiple select lists, but I think you use String[] for the get/set methods
in the Form bean, and Struts will populate it from the Request.  Take a look
at the struts-example webapp, it probably has an example of this.

> then delete them? the data is
> store in the database, so I need process delete action
> in server to delete them.

This part is not really Struts-specific.  You need to have already figured
out your data access layer before you add Struts to the mix.  And you
haven't told us what database, whether it has a JDBC driver, etc., so it's
pretty hard to advise.  While you _can_ put JDBC code directly in your
delete Action, resist the temptation!  Unless this is a small one-time
project purely for demonstration purposes, do it right the first time, or
else you'll be back doing it over later.  (BTDT... ;)

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Public Affairs, Information Resources Management
Arizona State University, Tempe AZ 

RE: get the selected values from list box

Posted by dream weaver <dr...@yahoo.com>.
Hi Wendy, Thanks for the advise, but I still not able
to make it work. Could you please give me more help? 

Yes it has a JDBC driver. I want the list box to make
multiple selections. First how I can get the multiple
selected values (User selected) to my action file for
processing? the following is on my JSP file:

<logic:iterate id="tool" name="listTools"
scope="request">

<option value="<bean:write name="tool"
property="poNbr"/>
<bean:write name="tool" property="ToolNbr"/>
<bean:write name="tool" property="ToolUnit"/>
<bean:write name="tool" property="history"/>
<bean:write name="tool" property="toolId"/>">

<bean:write name="tool" property="poNbr"/> 
<bean:write name="tool" property="ToolNbr"/>
<bean:write name="tool" property="history"/>
</option>
</logic:iterate>




--- Wendy Smoak <We...@asu.edu> wrote:
> > I have a List box in jsp file, 
> 
> Is a List box an HTML <select> that allows multiple
> selections?
> 
> > and I try to delete only selected values. 
> > Could you please tell me how to
> > get the selected values, 
> 
> What does the corresponding Form bean property look
> like?  I don't have any
> multiple select lists, but I think you use String[]
> for the get/set methods
> in the Form bean, and Struts will populate it from
> the Request.  Take a look
> at the struts-example webapp, it probably has an
> example of this.
> 
> > then delete them? the data is
> > store in the database, so I need process delete
> action
> > in server to delete them.
> 
> This part is not really Struts-specific.  You need
> to have already figured
> out your data access layer before you add Struts to
> the mix.  And you
> haven't told us what database, whether it has a JDBC
> driver, etc., so it's
> pretty hard to advise.  While you _can_ put JDBC
> code directly in your
> delete Action, resist the temptation!  Unless this
> is a small one-time
> project purely for demonstration purposes, do it
> right the first time, or
> else you'll be back doing it over later.  (BTDT...
> ;)
> 
> -- 
> Wendy Smoak
> Applications Systems Analyst, Sr.
> Public Affairs, Information Resources Management
> Arizona State University, Tempe AZ 
> 



__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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