This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Struts and the fly likes validator framework in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "validator framework in struts" Watch "validator framework in struts" New topic

validator framework in struts

ravindrasingh bist

Joined: Sep 26, 2005
Posts: 1
In my jsp i have two button

one is Search which will find the name in data base and if present it will get data and display in jsp

the other one is Add which will add data to database

i am using validator framework and i have define some validation
but my poblem is that these validation work on search also but that i dont want

when i click on search only one validation should work

and when i click on ADD all validation should work

how to do this

please help me
Ergin Er
Ranch Hand

Joined: Sep 06, 2005
Posts: 60
If you're just using validation for checking if inserted string matches the maxlength or correct characters, you can use validator.xml to set up validation for the form property (text field) you want to validate. Than you don't even need the validate method in your form.
This is just for standard validations only (using regular expressions). If you want to do an advanced validation, than you can use the standard validate method in the form, all you need to do there is don't compare your search field with any requirements (than it wont validate it )
Don't get me started about those stupid light bulbs.
subject: validator framework in struts