Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
    Bookmark Topic Watch Topic
  • New Topic

Adding dynamic rows in JSP

 
nagesh siddu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi All,
I am looking for a logic/ idea/ code snippet that can help in the following scenario

I am using struts 1.2 and tomcat web server.

I have a JSP which has two buttons, ADD and SAVE.
I need to display a row with three Textboxes with the first text box pre-populating a value from database (some thing like sequence number). The user enters the remaining two boxes.

When I press the ADD button a new row is to be displayed with the three textboxes, the first textbox gets a value from the data base. When I press SAVE, the form is to be submitted completely with the data filled by user and the generated sequence numbers.

What I am now trying:
I have an ArrayList kept in the request scope in the previous action. This array list has only one Value Object with three parameters and their getter/setter methods. I am using <logic: iterate >tag in my current JSP to iterate over the array list. It is properly showing one row. In my second action I have a switch case to identify that ADD button was pressed and I am getting the ArrayList from session object. Here I am adding a new Value Object to the list, and setting it again in session scope.

I t is displaying properly that is a new row is added when ever I press the add button.
Things are fine so far.

The problem:
1.When I press refresh(browser) button, it is still adding a new row.
2.I could not get he ArrayList from the form object.
Can any one point to some references/ examples similar to this?
Regards,
Nagesh
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.
 
    Bookmark Topic Watch Topic
  • New Topic