This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Struts and the fly likes while using struts can we make a jsp with multiple html forms?????? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "while using struts can we make a jsp with multiple html forms??????" Watch "while using struts can we make a jsp with multiple html forms??????" New topic

while using struts can we make a jsp with multiple html forms??????

sajjad ahmad
Ranch Hand

Joined: Jan 23, 2003
Posts: 78
HI !
i am using tomcat and struts for our web application the problem i am facing is i have one very large form (loan application form ) which consists of many information sequences and i cannot break it to different pages (yes i have breaked it into multiple pages which i include in a single page at runtime but it is just for minimizing html code in one page so that debugging could be easy )......
the problem is that i could not allow user to enter information in one portion of a form and submit it then move to another portion i need to move entire information in one single form (having some master detail sections as well) to the server end then do other things to that submitted information (validation,saving into adtabse e.t.c)...i could do that using one page and one large form been ......but have following things in mind
1) How could i manage the master details sections of this form that is struts populates entire bean with parameters from entire page but how struts will populate detail records which have one to many ratio.....

can it be a solution to devide that one large form into small html forms and then define all those form beans and actions for each form ... but is it precticle....and is there any example given for such problem .....
don't mind friends but i only need to get benifit from your knowledge before i waste the same time as some of you have already wated while solving the same problem ....
thanks in advance..
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
two things...
1. you should break the form up from the user interface perspective and use one form bean that is placed in the session to gather and/or display the data. when going from page to page, gather the data, but not submitted to the back end (DB) until the entire form is completed.

the individual page with the same form bean declarative validation can be achieve using the DynaActionValiationForm type (NOT DynaValidationForm type) which allows for you to map action path instead of form name to the validation.xml's configuration.

in essense, assuming you're breaking the form into 5 pages, you'll have 5 action paths (,,, etc.) that are mapped to the same form-bean with the scope='session'. in your validation.xml, you can then define the rules for each page somewhere along the line...

2. for the '1 to many' details, you need to use indexed properties to handle the data (see the struts user guide).

be sure to use the struts-html tag lib to display your form. the use of JSTL tag lib (core and format) is highly recommended.

-/a<br />certified slacker...yes, my last name is 'do' - <a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: while using struts can we make a jsp with multiple html forms??????
jQuery in Action, 3rd edition