struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Saul Q Yuan" <y...@dataanvil.com>
Subject RE: Problem with DynaValidatorForm
Date Wed, 07 Apr 2004 16:15:29 GMT
Hi,

Two thoughts. First, do you have the struts tag declaration in your jsp?
second, if you want to display error messages, I think you should set
message="false" in your <logic:messagesPresent tag. And lastly, try to
use a simple jsp to make it work first, then use xsl.

HTH,
Saul


> -----Original Message-----
> From: MARU, SOHIL (SBCSI) [mailto:sm8971@sbc.com] 
> Sent: Wednesday, April 07, 2004 11:53 AM
> To: Struts Users Mailing List
> Subject: Problem with DynaValidatorForm
> 
> 
> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message