This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring Boot in Practice and have Somnath Musib on-line!
See this thread for details.
Win a copy of Spring Boot in Practice this week in the Spring 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

submitting dynamic text boxes to ActionForm

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to correct my previous mail,
I am using jsp and javascripts.

Thanks
Krishna
 
Sheriff
Posts: 17031
298
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would use an indexed property
 
Krishna Mohan V
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic