Struts html:select question.

From: Senthil (murugastocks_at_yahoo.com)
Date: 06/29/04


Date: 29 Jun 2004 09:51:16 -0700

I want to accomplish....

I have to query a database whic return list of employee records.
In the front end, i have to show, list of all firstName's in a list
box style
(<select multiple> <option>). If user decides to add more employees,
then
i have to validate the name(with no special characters) and proceed to
the
next screen. There i need to show the newly added name in that screen
along
with all other fields empty. So that user can add that fields.

For this, i am doing like this.

When i query database through my Action execute() method, database
returns a set of employee records. I am capturing all those in my
NameBean[] and passing it to JSP.Code looks like this..

NameBean[] name = DatabaseReturnsListOfEmployees...
request.setAttribute("MyNameBean", name);

In my JSP
<select name="allName" multiple>
        <logic:iterate id="MyNameBean" name="MyNameBean">
                <option> <bean:write name="MyNameBean" property="firstName"/>
            </logic:iterate>
</select>

This code populates <select> <option> with all the firstName in the
list box.
Now my JSP looks like a ListBox.

The question is when i tried to add new firstName in the ListBox, how
do i take it to the Action class? Since ListBox MyNameBean is
NameBean[] and the Action's execute() method has ActionForm has form
value. Not a ActionForm[] value. See below.

public ActionForward execute(ActionMapping mapping,
                             ActionForm form,
                             HttpServletRequest request,
                             HttpServletResponse response)

Thanks in advance



Relevant Pages

  • Re: Help - Cant understand Code
    ... Listbox with MultiSelection used in Query ... I have the sample database in its orignial form. ... The subform doesn't have a SELECT statement however the query it is bound ...
    (microsoft.public.access.forms)
  • a special type of search form
    ... The list of all records you saw was probably a ListBox. ... Private Sub List1_DblClick ... You can also set criteria in your query based on values on ... >the form would be a list of every record in the database, ...
    (microsoft.public.access.forms)
  • populate a texbox using selection from listbox
    ... I will apologize first if this is longwinded here is my situation. ... I set the database up as ... for ease of use i created a combo box which uses a query to populate ... the comment associated with the part selected in the listbox, ...
    (microsoft.public.access.formscoding)
  • Re: VB Listbox?
    ... the listbox. ... running the query? ... db.open "whatever the connection string is for your database" ... What is a connection string or how do I find it for my database? ...
    (microsoft.public.vb.general.discussion)
  • Re: Implementable Set Theory and Consistency of ZFC
    ... Suppose I have a database consisting of employee records ... How do I build that application using your set theory? ... And the bees make honey. ...
    (sci.math)