1 5 package com.opensymphony.webwork.interceptor; 6 7 import com.opensymphony.xwork.ActionInvocation; 8 import com.opensymphony.xwork.interceptor.ConversionErrorInterceptor; 9 import com.opensymphony.xwork.util.OgnlValueStack; 10 11 12 20 public class WebWorkConversionErrorInterceptor extends ConversionErrorInterceptor { 21 23 protected Object getOverrideExpr(ActionInvocation invocation, Object value) { 24 OgnlValueStack stack = invocation.getStack(); 25 26 try { 27 stack.push(value); 28 29 return "'" + stack.findValue("top", String .class) + "'"; 30 } finally { 31 stack.pop(); 32 } 33 } 34 35 43 protected boolean shouldAddError(String propertyName, Object value) { 44 if (value == null) { 45 return false; 46 } 47 48 if ("".equals(value)) { 49 return false; 50 } 51 52 if (value instanceof String []) { 53 String [] array = (String []) value; 54 55 if (array.length == 0) { 56 return false; 57 } 58 59 if (array.length > 1) { 60 return true; 61 } 62 63 String str = array[0]; 64 65 if ("".equals(str)) { 66 return false; 67 } 68 } 69 70 return true; 71 } 72 } 73 | Popular Tags |