| Author |
validation problem in struts
|
shankhas sanyal
Ranch Hand
Joined: Jun 15, 2008
Posts: 44
|
|
hi all
i am new to struts and i am facing a problem. i hope to find a solution from all you guys ...
i have a simple user name and password login screen that checks the entered information from a mysql database. without validation framework this works. when i added the validation framework, supposed to show "name is required."
in my Actionbean i have added a validate(); when i comment this. i cannot login. but i can validate. when i uncomment this i can login but cant validate.
here are:
1. struts-config.xml
2. validator.xml
3. DBStrutsAction.java (action class)
4.DBStrutsLoginValidatorBean.java (my actionbean)
5. index.jsp (input file)
6. ApplicationResources.properties
thanks
please help me!!!
Shankha
struts-config.xml
validator.xml
DBStrutsAction.java (action class)
DBStrutsLoginValidatorBean.java (my actionbean)
index.jsp
ApplicationResources.properties
|
I love this place!
|
 |
udaykumar maddigatla
Ranch Hand
Joined: Feb 03, 2009
Posts: 69
|
|
Hi
You are extending ValidatorForm, that means, no need to write validate() method. Validation will be done from validation.xml file.
whatever the validations you want to write... you have to specify in the validation.xml. That is the main funda of extending the ValidatorForm.
If you still want to use both validation.xml as well as validate() method. You have to write the below line of code
instead of
Try to change the code as shown above. it will work
|
SCJP 5.0(84%), SCWCD 5.0(97%), SCDJWS 5.0(98%)
|
 |
shankha sanyal
Greenhorn
Joined: Sep 12, 2007
Posts: 6
|
|
udaykumar maddigatla wrote:Hi
You are extending ValidatorForm, that means, no need to write validate() method. Validation will be done from validation.xml file.
whatever the validations you want to write... you have to specify in the validation.xml. That is the main funda of extending the ValidatorForm.
If you still want to use both validation.xml as well as validate() method. You have to write the below line of code
instead of
Try to change the code as shown above. it will work
thank you very much it works now!!
Your the best ever!!!
|
 |
 |
|
|
subject: validation problem in struts
|
|
|