• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem is Struts

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi i am working with struts and hibernate currently....and i am facing a problem....

I hav a JSP in which according to the no. of entries in the DB , number of textboxes are generated dynamically using

logic:iterate(it iterates "List's Length" no. of times)......I have successfully retrived the data from the DB and displayed

on the JSP....but the USER of the system may wish to EDIT and REINSERT it in DB...but since they are dynamically

generated...there are no getters and setters for them in the ACTION FORM....what should i do for insertion..........


can anybody suggest any idea for this problem....please help me!!!
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi khushi,
you can make the name attribute of all the textfields generated same(name="TField"), and make an String array and its getter amd setter methods[get/setTField(String [] _tFields)]. the struts will autometically fill in this field in form bean.

hope this work with you too(it worked in mine case).

bye
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The best way to deal with this type of scenario in Struts is to use "Indexed Properties". You will find an explanation of how to use indexed properties along with a simple example in the JavaRanch Struts FAQ, question number 6.
reply
    Bookmark Topic Watch Topic
  • New Topic