项目结构

image

自定义类型转换类DateConvertor

 

image

 

 

 

 

Aciton 类

image

 

struts.xml

 

image

login.xml:

image

xwork.conversion.properties

image

 

测试页面:

image

 

解决方法:

原来在struts2自定义类型转换复合类型时需要对复合类型设置两个properties

1)在Login-conversion.properties【Action类名-conversion.properties】设置如下:

user.lastLogin=demo.struts2.type.Converter.DateConvertor

2)在复合类型所在包(此处为demo.struts2.beans)下新建一个User-conversion.properties【Bean类名-conversion.properties】

 

lastLogin=demo.struts2.type.converter.DateConvertor

 

posted on 2012-03-15 12:49  lane3000  阅读(320)  评论(0编辑  收藏  举报