SCJP 91%, SCWCD 97%
Solution is simple, instead of array in your action class use List<String>.
Also, there is a mistake on your side, that inside the form tag there sould be an iterator to generate the correct number of rows.
I don't want restrict the number of rows user can add, so if I use Iterator I should fix number of rows a user can enter rite? So I am doing through javascript. If I use iterator a fixed number of rows will be generated at the page load and user can't add extra row by clicking on "Add row" button right?
SCJP 91%, SCWCD 97%
Shashank Ag wrote:
I don't want restrict the number of rows user can add, so if I use Iterator I should fix number of rows a user can enter rite? So I am doing through javascript. If I use iterator a fixed number of rows will be generated at the page load and user can't add extra row by clicking on "Add row" button right?
No, not at all.
You should run iterator uptil the size of list and it will work fine.
SCJP 91%, SCWCD 97%
Shashank Ag wrote:You can simply write a getter method in your action class and put the logic of is list==null?0:list.size().
Call this getter mentod in in iterator tag's intialization.
Tom Rispoli wrote:Seeing your POJO might help.
I didn't get this part.Normally when I do something like this in my POJO I would make a class that holds 4 string variables (partNumber, componentDescription,quantity, unitPrice,totalPrice) and then I would make a single list out of objects of that class.
Tom Rispoli wrote:Glad I could help.
Get me the mayor's office! I need to tell her about this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|