Meaningless Drivel is fun!
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
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 )
I agree. Here's the link:
subject: validator framework in struts
It's not a secret anymore!