Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
    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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

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
 
Marshal
Posts: 67191
169
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.
 
You don't like waffles? Well, do you like this tiny ad?
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!