You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Farrell, Sarah" <Sa...@cccs.cccoes.edu> on 2002/02/12 16:56:30 UTC

repetitive form elements


I have a form, lets say it has 3 text input elements across and I have to
repeat this for a total of 10 rows.  So it's something like:

course name            program name          credit hours
course name            program name          credit hours
course name            program name          credit hours
course name            program name          credit hours
course name            program name          credit hours
etc.....

So the form elements are named like: 
courseName1, programName1, creditHours1
courseName2, programName2, creditHours2  etc....

So if I have 10 rows of these, the ActionForm has to have getters and
setters for each of these?

Is there a simpler way of coding this?

I know that struts has an iteration tag but it seems like the "wrong" thing
to use if you aren't doing any database querying when building the form.

I'm going to have to use several web pages with similar forms in my
application and it would be nice if there were a simpler way.

For example, if I were writing it in Perl <ducking> I could append a number
to the variable name in a loop and process everything that way.

As far as I know, there isn't a way to simplify this in Java or Struts.
Right?

Thanks,
Sarah


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>