Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Struts validator, multi-page form, and the page attribute

Thread Tools

Struts validator, multi-page form, and the page attribute

Robert Bowen
Posts: n/a
I am having serious problems with the Struts Validator using a
multi-page form.

I defined an ActionForm with about 50 fields, called "AllForm". I have
3 JSPs, each with about 15-20 fields, but ALL using the AllForm
ActionForm. The idea behind the page variable for your <form>
definitions in validations.xml, as I understand it, is two-fold:

1. A server-side validation is performed on fields whose page
attribute is LESS THAN or EQUAL TO the hidden "page" field in your

2. A client-side validation is performed only on those fields whose
page attribute is EQUAL TO the hidden "page" field in your JSP.

But I can't get it to work! Well, at least the client-side Javascript,
the server-side, for the moment, I am not worried about. I put a
hidden "page" field in my JSP with a value of "1", and the "page"
attribute equal to "1" in a bunch of my fields in the validations.xml.
Looking at the browser source, a bunch of EMPTY Javascript functions
are generated, validateRequired(), validateDate(), etc. NONE are
executed, no validation is performed!

However, if I change the "page" attribute to "0", and leave the hidden
field "1", it works! That's my first problem.

Just as annoying is when you go on to page 2 or of the mult-page form.
The theory is that ONLY the fields in page 2 are validated, assuming
you have the "page" attribute in the validations.xml, and the hidden
"page" field in the JSP with the same value.

But looking at the browser source, Javascript functions are generated
for page 1 fields as well, which of course causes javascript errors on

Anyone ever gotten client-side validation to work on a multi-page

I am all ears ... Willing to call you "the man" if you can show me
what the heck I am doing wrong!

Thanks a mil,
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Struts: Validation.xml fields's page attribute and correct forward page sickness Java 0 05-12-2006 08:41 AM
Eclipse and Ant with Struts: how to combine to generate javadoc api, how to map struts source to binary code for debugging Merlijn Java 0 03-24-2006 01:47 PM
Is it safe to point to Internet for locating struts DTD files in struts TLDs and XML files? Katie Wright Java 8 01-07-2005 03:37 PM
Struts - Cant pass attribute to page from Action class Anonymous Java 3 12-08-2004 06:15 AM
Struts Installation - missing struts.tld??? Jason Us Java 0 10-03-2003 11:36 PM