struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zeta <zoraidahida...@gmail.com>
Subject Re: DynaValidatorForm not working
Date Wed, 25 Oct 2006 11:20:57 GMT

Hi,

your code is ok, but you need to specified in the jsp page the next:

*******************************
the jsp file:

<!-- ============== input.jsp ============== 
<%@page language="java" pageEncoding="ISO-8859-1"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@taglib uri="/WEB-INF/struts-nested.tld" prefix="nested"%>
<%@taglib uri="/WEB-INF/struts-template.tld" prefix="template"%>
<%@taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<body>
<html:javascript formName="name of your form" />

<html:form action="inputSubmit" onsubmit="return validateFormName(this);">
	<table>	 
	<tr>
		<td align="left">
 			<tr>
	



Wjleon wrote:
> 
> Hi,
> 
> I am trying t use Dynavalidation in a simple test form and it is not
> working, i.e., I don’t get any error or something similar, instead, the
> app. “jumps” the validation rules I have set. Here is the extract of my
> code.
> 
> I hope someone can help me, here is a extract of my code:
> 
> <!-- ========== Strunrs-config ========== 
> <?xml version="1.0" encoding="ISO-8859-1" ?>
>  
> <!DOCTYPE struts-config PUBLIC
>           "-//Apache Software Foundation//DTD Struts Configuration
> 1.1//EN"
>           "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
>           
> <struts-config>
>  
> <!--  *********** Form Bean Definitions ******* -->
>   <form-beans>
> 	<!--  ***************** LoginForm Form
> *************************************** -->
>     <form-bean 	name="inputForm" 
> 				type="org.apache.struts.validator.DynaValidatorForm">
> 					<form-property 	name="userName" 
> 						type="java.lang.String" 
> 						initial=""/>
>     </form-bean>
>   </form-beans>
>  
> <!--  ========== Action Mapping Definitions ===== -->
>   <action-mappings>
>   	<!--  ============== ReloadPPCForm Action ============== -->
>     <action name="inputForm"
>     		input="/input.jsp"     		 
>     		path="/inputSubmit"
>     		scope="request" 
>     		type="test.InputAction" 
>     		validate="true">
>       		<forward name="success" path="/home.jsp" />
>       		<forward name="failure" path="/inputForm"/>  			
>     </action>
>   </action-mappings>
>  
> <!--  ========== Message Resources Definitions ===== -->
>   <message-resources null="true"
>   	parameter="test.ApplicationResources"/>
>  
> <!--  ========== Plug-ins Definitions =============== -->
>   <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
>     <set-property 	property="pathnames" 
>     				value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
>     <set-property property="stopOnFirstError" value="true" />
>   </plug-in>
> </struts-config>
> 
> ************************* Validation.xml **********
> <!-- ========== validation.xml ========== 
> <form-validation>
> 	<formset>
> 		<form name="inputForm">
> 		   <field property="userName"
>                     depends="required,email">
>                 <arg0   key="error.inputForm.userName"/>
>             </field>
> 		</form>
> </formset>
> </form-validation>
> 
> ********************************
> the jsp file:
> 
> <!-- ============== input.jsp ============== 
> <%@page language="java" pageEncoding="ISO-8859-1"%>
> <%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
> <%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
> <%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
> <%@taglib uri="/WEB-INF/struts-nested.tld" prefix="nested"%>
> <%@taglib uri="/WEB-INF/struts-template.tld" prefix="template"%>
> <%@taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>  
> <html>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <body>
> <html:form action="inputSubmit">
> 	<table>	 
> 	<tr>
> 		<td align="left">
>  			<tr>
> 	    		<td align="right">
> 					<bean:message key="login.email"/>
> 				</td>
> 	   			<td align="left">
> 					<html:text 	property="userName" 
> 						size="15" 
> 						maxlength="25" />
> 				</td>
> 	  		</tr>
> 	  		<tr>
> 	  			<td colspan="2" align="right">
> 	  				<html:errors property="userName" />
> 	  			</td>
> 	  		</tr>	
> 	<tr>
> 		<td>
> 			<html:submit value="Enviar"/>
> 		</td>
> 	</tr>
> 	</table>
> </html:form>
> </body>
> </html>
> 
> 

-- 
View this message in context: http://www.nabble.com/DynaValidatorForm-not-working-tf2504497.html#a6990180
Sent from the Struts - Dev mailing list archive at Nabble.com.


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


Mime
View raw message