一、首先转换Date类型
1、首先定义一个DateFormat.jsp
2、定义转化action类 在com.test.action中定义DateFormatAction.class
3、在src目录下定义一个struts.xml
其中<action name="" class="">
name为DateFormat.jsp中action的值,class为刚刚中com.test.action 中定义的类
其中<result name="success">/result.jsp</result> name为com.test.action中DateFormatAction.class中execute()方法返回的String类型的值,
result.jsp为跳转页面,也就是输出结果的页面
4、定义result.jsp进行结果输出
这里直接 使用的是struts2提供的标签库
需在jsp开始引入<%@ taglib uri="/struts-tags" prefix="s" %>即可
二、自定义类型转换器以转换Point为例
1、
2、
3、
4、
5、
6、