Let me rephrase my question.

I have a table which looks like this.. example
<table width="300" border="0" cellspacing="1" cellpadding="1">
<tr>
  <th>Name</th>
  <th>Sex</th>
</tr>
<tr>
<td><html:text  property="name" /></td>
  <td><html:select  property="sex" >
      <html:option value="">&nbsp;</html:option>
       <html:option value="M" >Male</html:option> 
       <html:option value="F" >Female</html:option> 
    </html:select> 
  </td> 
  </tr>
<tr>
  <td><html:text property="name" /></td>
  <td><html:select  property="sex" >
      <html:option value="">&nbsp;</html:option>
      <html:option value="">&nbsp;</html:option>
       <html:option value="M" >Male</html:option> 
       <html:option value="F" >Female</html:option>
    </html:select> 
  </td>
</tr>
</table>

So when I add data like
Sashi     Male
Sushma FEMALE   

now I submit the form, and say there are some validation errors 

how can I build the table with the above values retrieving from the Form
Bean .My  form bean has the following methods

public String[] getName(){
    return name;
  }

  public void setName(String[] newName){
    name = newName;
  }

  public String[] getSex(){
    return sex;
  }

  public void setSex(String[] newSex){
    sex = newSex;
  }

The values are getting stored in the array, but to get them back and
build my table is what is not clear to me..

<logic:iterate > may do the job but how to use it??

Hope I am clear now


>>> [EMAIL PROTECTED] 06/05/03 11:30AM >>>

Sounds like you might be missing input="theform.jsp" in your action
where
theform.jsp is the name of your JSP you want to have come back with the
errors.  Also, have <html:errors/> in the JSP to report the errors (just
as
important (more) than repopulating).

If this doesn't help find a better (for you) online struts tutorial. 
What
you are trying to do  is a freebie in struts (if everything is setup
right).


-----Original Message-----
From: Sashi Ravipati [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 05, 2003 10:59 AM
To: [EMAIL PROTECTED]
Subject: How to repopulate Form which has html elements with same name

Hi

I am a newbie to struts... 

I have a dynamic table which has a <html:text >  and a <html:select> .
The
user cliks on a add button and enter values in each row of the table and
submits the form. 

How can I repopulate the valuse if validation fails.

Can some body give a working exapmle of the Action Form that is required
for
this kind of requirement.

I found this in Ted Husted site but had no clue as what he is trying to
do,
What is RESULT etc
----------------------------------------------------------------------------
---------------
<TABLE><html:form action="/item/StoreCategory"> 
<logic:iterate name="RESULT" property="iterator" id="row">
<TR>
<TH>name</TH>
<TH>category</TH>
</TR>
<TR>
<TD><bean:write name="row" property="name"/></TD>
<TD><%-- REMEMBER TO SPECIFY THE ITERATE ID AS THE NAME --%>
<html:select name="row" property="category">
<html:option value="ART">Art</html:option>
<html:option value="AUT">Automotive</html:option>
<%-- ... --%>
</html:select>
<%-- REMEMBER TO SPECIFY THE ITERATE ID AS THE NAME --%>
<html:hidden name="row" property="key"/>
</TD>
</TR>
</logic:iterate>
<TR>
<TD colspan="2" align="right">
<html:submit/>
</TD>
</TR>
</html:form>
</TABLE>
----------------------------------------------------------------------------
-------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to