我在eclipse中设计了一个类,继承了DefaultTypeConverter,然后重写其中的convertValue方法,如下:
public Object convertValue(Map arg0, Object arg1, Class arg2) {
// TODO Auto-generated method stub
return super.convertValue(arg0, arg1, arg2);
}
但是例子程序重写的是
public Object convertValue(Map<String, Object> context, Object value, Class toType) {这样造成  value现在报错 value cannot be resolved
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
try { 
if(toType == Date.class){//当字符串向Date类型转换时
String[] params = (String[]) value;// request.getParameterValues() 
return dateFormat.parse(params[0]);
}else if(toType == String.class){//当Date转换成字符串时
Date date = (Date) value;
return dateFormat.format(date);
}
} catch (ParseException e) {}
return null;
是否因为重写方法参数不一样造成的,还是value的写法有问题,