Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Adding dynamic rows in JSP  RSS feed

 
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
 
Author and ninkuma
Marshal
Posts: 66819
168
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.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!