I am trying to validate wether user selected a check box or not.
In
jsp I have a collection of beans and displaying as follows.
<html:form action="/edit.do?method=edit">
<logic:iterate indexId="i" id="collection" name="dataForm" property="collection">
<%if (i.intValue()%2 == 0)
{%>
<tr>
<%}else{%>
<tr bgcolor=#C0C0C0>
<%}%>
<td>
<html:checkbox name="collection" property="sceneid" indexed="true"/>
</td>
<td>
<bean:write name="collection" property="personid" />
</td>
</tr>
</logic:iterate>
<tr><td><html:submit styleClass="button" property="edit">Edit</html:submit><td>
</html:form>
When I submit it is calling action class and edit method and returning the forward jsp. But it sgould validate.
Here is my validate.xml file
<form name="/edit">
<field property="sceneid" indexedListProperty="collection" depends="required">
<arg0 key="Select the check box" resource="false"/>
</field>
</form>
"/edit" is my action path name. I am not using formName but I tried with form name also.
Action Class :
public class LifeAAction extends DispatchAction {
public ActionForward edit(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
return mapping.findForward("edit");
}
}