File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Adding dynamic rows in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

Adding dynamic rows in JSP

nagesh siddu
Greenhorn

Joined: Nov 09, 2005
Posts: 6
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

Joined: Jan 10, 2002
Posts: 60050
    
  65

Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adding dynamic rows in JSP
 
Similar Threads
Dynamically adding rows to JSP
updating ArrayList on parent from child window
Adding Dynamic Rows to Table using addrow button
Dynamic row generation using struts
Dynamically build a form