Hi,
   I am a newbie to using the struts framework and am trying to get Validation 
framework to work. It seems to be working fine,ie if error checks fail it redirects me 
to the page where it should but does not display the errors. I have read over the 
archives and corrected couple of things I was doing wrong(like not putting html:errors 
in jsp) however it still doesn't work. Any help will be appreciated.

Here is my struts-config.xml

<struts-config>
        <!-- ======== Form Bean Definitions =================================== -->
        <form-beans>
                <form-bean name="LoginForm" 
type="org.apache.struts.validator.DynaValidatorForm">
                        <form-property name="username" type="java.lang.String"/>
                        <form-property name="password" type="java.lang.String"/>
                </form-bean>
        </form-beans>
        <!-- ========== Action Mapping Definitions ==============================-->
        <action-mappings>
                <!-- login form -->
                <action path="/login" type="com.sbc.hrtech.loa.ui.action.LoginAction" 
name="LoginForm" scope="request" validate="true" input="/jsp/index.jsp">
                        <forward name="success" path="/WEB-INF/jsp/employeeIndex.jsp"/>
                        <forward name="failure" path="/jsp/index.jsp"/>
                </action>
        </action-mappings>
        <!-- ========== Message Resources Definitions =========================== -->
        <message-resources parameter="ApplicationResources.properties"/>
        <!-- Plugins -->
        <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
                <set-property property="pathnames" 
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
        </plug-in>
</struts-config>

VALIDATION.xml

<form-validation>
        <formset>
                <form name="LoginForm">
                        <field property="username" depends="required">
                                <arg0 key="prompt.username"/>
                        </field>
                        <field property="password" depends="required">
                                <arg0 key="prompt.password"/>
                        </field>
                </form>
        </formset>
</form-validation>



ApplicationResources.properties

#-- validation errors
errors.required={0} is required

#-- tag names
prompt.username=SBCUID
prompt.password=PassPhrase

Error Message: {0}

And the page itself, its an xsl template being called from the jsp
I have tried <html:errors/> before trying logic:messagesPresent, but neither worked.
<xsl:template match="/">
        <html:xhtml/>
    <html>
        <head>Struts Test App</head>
        <body>
            <br/>
            This is a test applications
            <br/>
            <br/>
            
                        <!--html:errors/-->
                        <logic:messagesPresent message="true">
                               <html:messages id="message" message="true">
                                 <span id="success"><c:out 
value="${message}"/></span><br>
                               </html:messages>
                        </logic:messagesPresent>
            <html:form 
                action="login">
                <table>
                        <tr>
                            <td>SBCUID:
                            </td>
                            <td><html:text property="username"/></td>
                         </tr>
                         <tr>
                             <td>
                                PassPhrase
                            </td>
                             <td>
                            <td><html:text property="password"/></td>
                            </td>
                         </tr>
                         <tr>
                             <td>
                                                                <html:submit/>
                            </td>
                        </tr>
                </table>
            </html:form>
            
        </body>
    </html>        
</xsl:template>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to