• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Page attribute in validator

 
Shruthi Babu
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic