Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0.3
-
None
-
Windows XP, JDK 1.4.2
Description
The ValidationInterceptor gets invoked no matter what. It would be nice if you could specify that it wouldn't be invoked for certain cases. This allows the user to specify less actions in xwork.xml. For example, I don't want to invoke it when users click on Cancel, Delete or when they're first requesting the form. Here's a method from the custom interceptor I wrote.
protected void before(ActionInvocation invocation) throws Exception {
Action action = invocation.getAction();
String context = invocation.getProxy().getActionName();
final Map parameters = ActionContext.getContext().getParameters();
// don't validate on cancel, delete or GET
if (ServletActionContext.getRequest().getMethod().equals("GET")) {
if (log.isDebugEnabled())
} else if (parameters.containsKey("cancel") || parameters.containsKey("delete")) {
if (log.isDebugEnabled())
} else {
if (log.isDebugEnabled())
ActionValidatorManager.validate(action, context);
}
}
I suppose it's easy enough to extend, but I thought this might be a nice feature.