struts2自定义局部类型转换器

来源:互联网 发布:tensorflow源代码 编辑:程序博客网 时间:2024/05/21 04:21

1、新建class.使之继承DefaultTypeConverter

2、右键->source->Overrides/impletments methods实现父类方法:

@Overridepublic Object convertValue(Map<String, Object> context, Object value,Class toType) {// TODO Auto-generated method stub... return super.convertValue(context, value, toType);}

3、将上面的类型转换器注册为局部类型转换器:

在Action包下放置HelloWorldAction-conversion.propertites文件,在此文件中的内容是:

属性名称=类型转换器的全类名

birthday = com.feng.type.Converter.DateTypeConverter



原创粉丝点击