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/>

Reply via email to