Basically, the way I would envision this, is that the validation framework checks to make sure the 'username' and 'password' fields are not NULL, or meet some form of low level character count.
Anyway, that is good. What I would do, is continue with that, then after the validator says this is acceptable, it should go to your controller. Within the controller, you should call a business object with the two fields, username, and password. The business object should return a value of success or failure. If success, set user into session (or whatever) and let them in. If not, throw a global exception (set a global exception in struts-config.xml) and set a message into the request. This should send them back to the login screen and they will see a message that the login was NOT successful. Make sense? I think that is how I used to do it. Scott -----Original Message----- From: Thomas Thomas [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 29, 2006 3:52 PM To: Struts Users Mailing List Subject: validate question ... Hi, My web-application allows a user to authenticate to the website. I check for login and password with the Validator Framework (correct length, correct carachters, ...) Then display with <html:errors property="login"/> and <html:errors property="password"/> in my jsp. This work ok. If he the fields are valid, I need to check in my DB if the user is really subscribed. 1) Where should I do the DB validation ? 2) How do I return the errors to JSP, how do I display the errors in my jsp ? can I have something similar like : <html:errors property="dberror"/> or something like that ? what's best ? I have for this a "DynaValidatorForm" and an Action "LoginAction" if fields are correct for the validator : <form-beans> <form-bean name="loginForm" type=" org.apache.struts.validator.DynaValidatorForm"> <form-property name="login" type="java.lang.String" /> <form-property name="password" type="java.lang.String" /> </form-bean> [...] <action path="/Login" type="controllers.submits.LoginAction" name="loginForm" input="/Error.do" validate="true" scope="request"> <forward name="index" path="/index.jsp"/> <forward name="chat" path="/chat_form.jsp"/> </action> And my JSP : login : <br/> <html:text property="login" size="10"/> <!-- <span id="txtUsernameMsg"> Le login spécifié est invalide ! </span>--> <html:errors property="login"/> <--- DISPLAY error if login is empty <!-- I WANT TO DISPLAY A MESSAGE HERE IF USER DOESNT EXIST IN DATABASE, how ? --> <br/> mot de passe : <br/> <html:password property="password" size="10"/> <!-- <span id="txtPasswordMsg"> Le mot de passe spécifié est invalide ! </span> --> <html:errors property="password"/> <--- DISPLAY error if password is empty <br/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]