This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Problem is Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem is Struts" Watch "Problem is Struts" New topic
Author

Problem is Struts

khushi kumar
Greenhorn

Joined: Mar 14, 2007
Posts: 2
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!!!
Lalit Nagalkar
Ranch Hand

Joined: Aug 22, 2006
Posts: 47
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


SCJP 1.4
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem is Struts
 
Similar Threads
please help !!! :confused:
Facing Problem with String replaceAll method
cache tld
Integrating Billdesk in portlet Application
Store PDF files in the database