This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

submitting dynamic text boxes to ActionForm

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am struck in the middle of one web application. I am using struts 1.1 framework.

I have a form where I have nearly 12 text boxes per row, which are generated dynamically.

means I have a form where I have 12 text boxes per row and I am assigning name dynamically.[I am not using plain jsp and javascript].
The number of text boxes depends on the value fetched from database.

suppose if my database value is 10,
my form will be having 12 [Textboxes per row] * 10[no. of rows] = 120 textboxes. if the database value is 5, I will be having 60 textboxes.

my question is
How to write the action form.

I think it is a bad programming to write 120 properties and 240 methods [getter and setter].Also beacuse the textboxes changes depending on the database value, I think I cannot define 60 / 120 /200 properties and getter and setter methods.

How to handle this situation and submit the data entered by user to the action form, get them into Action class.

Any help on this is appreciated.

Thanks
Krishna.
 
Krishna Mohan V
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to correct my previous mail,
I am using jsp and javascripts.

Thanks
Krishna
 
Sheriff
Posts: 15779
264
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would use an indexed property
 
Krishna Mohan V
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Since I am rendering the jsp using dynamic text boxes and doing validations of the textboxes using javascript,
can you suggest me to go for indexed porperties.

Thanks
Krishna.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If each row is a separate object, you can just create a collection of the objects and iterate over them with the struts logic:iterate tag.
 
Time is the best teacher, but unfortunately, it kills all of its students - Robin Williams. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic