1
ActionForm and 3 Action objects. The reason for the 3 actions is it gives you
flexibility in your business implementation. I personally would not do any
business logic till i have all values in hand. So ActionObject1 and
ActionObject2 will just send the user to the correct next pages. It is in
Action3 that you would finally do business implementation (like update database
etc..)
A
dirty flag is nothing but a hidden variable in a jsp page. Every time the user
submits information, the value of this hidden variable is checked. Based on the
value, the corresponding error check is done. I believe somebody in the mailing
list have coined the term 'dirtyFlag' because it is not that elegant a way of
doing it. Maybe some experts in this group will come with a better alternative.
If so i am willing to experiment with that alternative.
For
example.. If you have Page 1 - contains firstName,
lastName
Page 2 - contains Phone Number and Address
Page 3 - contains Personal Interests and maybe CC no
You
would set a hidden variable in all 3 pages. Same name but different values in
the 3 pages. Your form would have a private variable which is the name of the
hidden variable.
When
the user submits info.. (say from page 1), in your ActionForm the value of
the dirtyFlag is set to page1. In your validate method you would do a
conditional statement
if(dirtyFlag equals page1) { check for firstName
and lastName values for errors. If errors occur struts will send you back to
Page1 else struts will take you back to normal processing}
if(dirtyFlag equals page2) { check for phone
# and Address values for errors. If errors occur struts will send you back
to Page2 else struts will take you back to normal processing}
if(dirtyFlag equals page3) { check for all
values. If errors occur struts will send you back to Page3. else struts
will continue with normal processing}
The reson you are checking for all
the values (in page 3 submit) is to satisfy yourself that all values are entered
properly. If in page1 and page 2 you encounter errors, struts will automatically
send you to the correct page.
|
- *** implementing consecutive form validation? *** Jonathan
- RE: *** implementing consecutive form validation? *... Nanduri, Amarnath
- RE: *** implementing consecutive form validatio... David Winterfeldt
- Re: *** implementing consecutive form validatio... Jonathan
- Nanduri, Amarnath