File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Validation.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Validation.xml" Watch "Validation.xml" New topic


somin bhuvan

Joined: Jun 01, 2005
Posts: 22

I have a ActionForm which contains 3 attributes like:-

Phone, Email, Credit Card

Validation.xml contains validation for above attributes.
My Page behaves kind of pagination,

In 1st Page it has only Phone
In 2nd Page it has Email and Credit Card

While i validate for 1st Page; the other two validation also comes into the first page as those validation are done in Validation.xml. I dont know how to neglect the other two validation at run time for the first Page. Please help me.

Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
Look at this link for info on using the page attribute:

Multi Page Forms

The field element has an optional page attribute. It can be set to an integer. All validation for any field on a page less than or equal to the current page is performed server side. All validation for any field on a page equal to the current page is generated for the client side Javascript. A mutli-part form expects the page attribute to be set.

<html:hidden property="page" value="1"/>

I will admit that I do not use this technique. I think it requires you to use session scope for your forms because when validation runs for page 2 it expects the values from page 1 to be populated. I have normally not used the validator framework for wizard pages and just implemented the validate method myself.

- Brent
I agree. Here's the link:
subject: Validation.xml
It's not a secret anymore!