Hello,
I am trying to validate two fields in a JSP using the Struts Validator plugin. When I hit the "Submit" button nothing happens. I get the feeling that the action is being processed, but because the fields are empty, an error should pop up.
This is my JSP :
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<html>
<body>
<html:errors/>
<html:form action="test.do">
<table>
<tr>
<td>Name:</td>
<td><html:text property="name"/></td>
</tr>
<tr>
<td>Age:</td>
<td><html:text property="age"/></td>
</tr>
<tr><td><html:submit/></td></tr>
</table>
</html:form>
</body>
</html>
This is my validation.xml file :
form-validation>
<global/>
<formset>
<constant>
<constant-name>dateFormat</constant-name>
<constant-value>yyyy-MM-dd</constant-value>
</constant>
<form name="datePPOFilterForm">
<field property="fromdate" depends="required">
<arg0 key="label.from"/>
</field>
<field property="todate" depends="required">
<arg0 key="label.to"/>
</field>
</form>
<form name="testForm">
<field property="name" depends="required">
<arg0 key="label.from"/>
</field>
<field property="age" depends="required">
<arg0 key="label.to"/>
</field>
</form>
</formset>
</form-validation>
This is my struts-config file fragment(s)
NB. I have included the Validator Plug-in in the struts-config file.
I've extended ValidatorForm and not Action Form for the Form bean.
I've included the relevant error keys from the validation-rules.xml file into my properties file.
When I hit the button(submit) nothing happens. No messages whatsoever
I am trying to validate two fields in a JSP using the Struts Validator plugin. When I hit the "Submit" button nothing happens. I get the feeling that the action is being processed, but because the fields are empty, an error should pop up.
This is my JSP :
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<html>
<body>
<html:errors/>
<html:form action="test.do">
<table>
<tr>
<td>Name:</td>
<td><html:text property="name"/></td>
</tr>
<tr>
<td>Age:</td>
<td><html:text property="age"/></td>
</tr>
<tr><td><html:submit/></td></tr>
</table>
</html:form>
</body>
</html>
This is my validation.xml file :
form-validation>
<global/>
<formset>
<constant>
<constant-name>dateFormat</constant-name>
<constant-value>yyyy-MM-dd</constant-value>
</constant>
<form name="datePPOFilterForm">
<field property="fromdate" depends="required">
<arg0 key="label.from"/>
</field>
<field property="todate" depends="required">
<arg0 key="label.to"/>
</field>
</form>
<form name="testForm">
<field property="name" depends="required">
<arg0 key="label.from"/>
</field>
<field property="age" depends="required">
<arg0 key="label.to"/>
</field>
</form>
</formset>
</form-validation>
This is my struts-config file fragment(s)
NB. I have included the Validator Plug-in in the struts-config file.
I've extended ValidatorForm and not Action Form for the Form bean.
I've included the relevant error keys from the validation-rules.xml file into my properties file.
When I hit the button(submit) nothing happens. No messages whatsoever