01: package org.strecks.controller.chain.command;
02:
03: import javax.servlet.http.HttpServletRequest;
04:
05: import org.apache.struts.action.ActionMapping;
06: import org.apache.struts.chain.contexts.ActionContext;
07: import org.apache.struts.chain.contexts.ServletActionContext;
08: import org.strecks.form.handler.FormValidationHandler;
09: import org.strecks.form.handler.FormValidationHandlerImpl;
10:
11: /**
12: * Replaces <code>ValidateActionForm</code> in chain
13: * @author Phil Zoio
14: */
15: public class ValidateActionForm extends
16: org.apache.struts.chain.commands.servlet.ValidateActionForm {
17:
18: private FormValidationHandler formValidationHandler;
19:
20: public ValidateActionForm() {
21: super ();
22: formValidationHandler = newFormValidationHandler();
23: }
24:
25: protected FormValidationHandler newFormValidationHandler() {
26: return new FormValidationHandlerImpl();
27: }
28:
29: @Override
30: public boolean execute(ActionContext context) throws Exception {
31: super .execute(context);
32: postExecute(context);
33: return false;
34: }
35:
36: void postExecute(ActionContext context) {
37: ServletActionContext sc = (ServletActionContext) context;
38:
39: final HttpServletRequest request = sc.getRequest();
40: final ActionMapping actionConfig = (ActionMapping) sc
41: .getActionConfig();
42: final Boolean formValid = context.getFormValid();
43:
44: formValidationHandler.postValidate(request, actionConfig,
45: formValid);
46: }
47:
48: }
|