1 16 17 package org.apache.struts.chain.servlet; 18 19 20 import org.apache.commons.chain.Context; 21 import org.apache.commons.chain.web.servlet.ServletWebContext; 22 import org.apache.commons.logging.Log; 23 import org.apache.commons.logging.LogFactory; 24 import org.apache.struts.action.ActionErrors; 25 import org.apache.struts.action.ActionForm; 26 import org.apache.struts.action.ActionMapping; 27 import org.apache.struts.chain.AbstractValidateActionForm; 28 import org.apache.struts.config.ActionConfig; 29 import org.apache.struts.Globals; 30 31 32 42 43 public class ValidateActionForm extends AbstractValidateActionForm { 44 45 47 48 private static final Log log = 49 LogFactory.getLog(ValidateActionForm.class); 50 51 52 54 55 62 protected ActionErrors validate(Context context, 63 ActionConfig actionConfig, 64 ActionForm actionForm) { 65 66 ServletWebContext swcontext = (ServletWebContext) context; 67 ActionErrors errors = (actionForm.validate((ActionMapping) actionConfig, 68 swcontext.getRequest())); 69 70 if (errors != null && !errors.isEmpty()) { 72 if (actionForm.getMultipartRequestHandler() != null) { 73 if (log.isTraceEnabled()) { 74 log.trace(" Rolling back multipart request"); 75 } 76 actionForm.getMultipartRequestHandler().rollback(); 77 } 78 } 79 80 swcontext.getRequest().setAttribute(Globals.ERROR_KEY, errors); 86 87 return errors; 88 89 } 90 91 92 } 93 | Popular Tags |