How to work with a form that has several inputs with the same name
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   stewart_gray
Posted On:   Wednesday, February 6, 2002 11:44 AM

Hi. I want to build a form that has a data entry grid. Each column has fields with the same name. The number of rows is not large but is only known at run-time (depending on the number of child records in the database). For example: id    name    quantity id    name    quantity id    name    quantity Previously, using servlets I used the HttpServletRequest method getParameterValues to get a String array of the values for each field. The perform method of the Struts Action class only seems to have one ActionForm associated with it rather than an array of ActionForms. Please, how can I build my form under Struts?    More>>

Hi.

I want to build a form that has a data entry grid. Each column has fields with the same name. The number of rows is not large but is only known at run-time (depending on the number of child records in the database). For example:

id    name    quantity

id    name    quantity

id    name    quantity

Previously, using servlets I used the HttpServletRequest method getParameterValues to get a String array of the values for each field.

The perform method of the Struts Action class only seems to have one ActionForm associated with it rather than an array of ActionForms.

Please, how can I build my form under Struts?

   <<Less

Re: How to work with a form that has several inputs with the same name

Posted By:   Ted_Husted  
Posted On:   Tuesday, February 12, 2002 04:41 PM

You can define each column as an array, and Struts will
autopopulate it, like any other.



private String[] id= {};
public String[] getId() {
return this.id;
}
public void setItem(String id[]) {
this.id = id;
}

And so forth


HTH -Ted

About | Sitemap | Contact