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

Page attribute in validator

Shruthi Babu
Ranch Hand

Joined: May 04, 2007
Posts: 54
I have a form which is used by 2 jsps say A.jsp and B.jsp

There are validation for 3 fields for A.JSP whereas I need to validate only one of them for B.jsp.

How to handle this in validation.xml? Should I do something with the page attribute.

Any help is highly appreciated
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
The page attribute seems to be designed for wizard type pages where the form is saved in session. It validates all fields where the page is equal to or less than the current page. I don't think that will work for you.

If your version of Struts supports it, then there is the validwhen rule that you might be able to use (I am still using 1.1 which does not support validwhen). There is always the fall back of implementing the validate method yourself or you might be able to use ValidatorActionForm which applies validation rules based on the name of the action instead of the name of the form.

- Brent
Shruthi Babu
Ranch Hand

Joined: May 04, 2007
Posts: 54
I have the form in session .

My problem is

Form A extends Form B

and all the three fields are validated in form form b

But I need to validate only one of the 3 fields in Form A.

How to handle this?
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Please check your private messages.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Page attribute in validator
It's not a secret anymore!