I was wondering if this was the only way to accomplish this? I'd like to be able to keep that kind of logic out of my form, and put it in the validation.xml file, or another configuration file...
Form:
public class FringeForm extends ValidatorForm implements java.io.Serializable {
private String field1;
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors actionErrors = new ActionErrors();
String method = request.getParameter("method");
if ("save".equals(method)) {
actionErrors = super.validate(mapping, request);
}
return actionErrors;
}
// getters and setters omitted for brevity }
Validation: <form-validation> <!-- Define global validation config in validation-global.xml --> <formset> <form name="fringeForm"> <field property="field1" depends="required"> <arg0 key="fringeForm.field1"/> </field> </form> </formset> </form-validation>
And the action mapping looks like this (actual class extends DispatchAction):
<action path="/fringe" type="org.springframework.web.struts.DelegatingActionProxy" name="fringeForm" scope="request" parameter="method" input="/WEB-INF/pages/fringeForm.jsp" > <forward name="edit" path="/WEB-INF/pages/fringeForm.jsp"/> <forward name="success" path="/index.jsp"/> </action>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]