• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

validation problem in struts

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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



 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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!!!
 
Time is mother nature's way of keeping everything from happening at once. And this is a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic