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 ==============
<[EMAIL PROTECTED] language="java" pageEncoding="ISO-8859-1"%>
<[EMAIL PROTECTED] uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<[EMAIL PROTECTED] uri="/WEB-INF/struts-html.tld" prefix="html"%>
<[EMAIL PROTECTED] uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<[EMAIL PROTECTED] uri="/WEB-INF/struts-nested.tld" prefix="nested"%>
<[EMAIL PROTECTED] uri="/WEB-INF/struts-template.tld" prefix="template"%>
<[EMAIL PROTECTED] 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#a6982599
Sent from the Struts - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]