Posted By:
Brian_Boyle
Posted On:
Sunday, February 29, 2004 03:20 PM
Hi!, I'm using struts 1.1. I have a logon page and I want to validate whether a user exists and if the password if correct before the user logs in. I'm using EJB so there is a fair amount of code to do this so I have used the validate method in my loginForm to do this for me and it works fine. But now I want to use the validator framework's "required" method to verify that data has been entered into the fields. On page 391 of Struts in Action, it says that the validate method and validator framework van work alongside each other. The following code allows you to do it and I have implemented this code in my class: public ActionErrors validate(ActionMapping mapping,HttpServletRequest request) {
More>>
Hi!,
I'm using struts 1.1. I have a logon page and I want to validate whether a user exists and if the password if correct before the user logs in. I'm using EJB so there is a fair amount of code to do this so I have used the validate method in my loginForm to do this for me and it works fine.
But now I want to use the validator framework's "required" method to verify that data has been entered into the fields. On page 391 of Struts in Action, it says that the validate method and validator framework van work alongside each other. The following code allows you to do it and I have implemented this code in my class:
public ActionErrors validate(ActionMapping mapping,HttpServletRequest request) {
ActionErrors errors = super.validate(mapping, request); if(errors==null)
errors = new ActionErrors();
I also extend ValidatorActionForm and I have updated validation.xml to look like this:
However, when I don't enter any data the validation is not working. Have I missed a step in setting up the validation framework?
Hope someone can help,
Thanks,
B.
<<Less