package com.tools.converter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.sql.Date;
import java.util.Map;
import org.apache.struts2.util.StrutsTypeConverter;
import com.opensymphony.xwork2.XWorkException;
public class DateConverter extends StrutsTypeConverter {
public static final String DATE_FORMAT = "yyyy/MM/dd";
@Override
public Object convertFromString(Map context, String[] values, Class toClass) {
Date[] result = null;
if ((values != null) && (values.length >= 1)) {
result = new Date[values.length];
for (int i=0; i < values.length; i++){
result[i] = convertToDate(values[i]);
}
}
if (result != null && values.length == 1) {
return result[0];
} else {
return result;
}
}
@Override
public String convertToString(Map context, Object o) {
String result = null;
if (o instanceof Date) {
result = new SimpleDateFormat(DATE_FORMAT).format(o);
}
return result;
}
private Date convertToDate(String value) {
Date result = null;
if (value == null || value.isEmpty()) {
return result;
}
try {
result = new Date(new SimpleDateFormat(DATE_FORMAT).parse(value).getTime());
} catch (ParseException e) {
throw new XWorkException("Could not parse date", e);
}
return result;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
flex+struts2+spring简单整合,用httpService通信
共73个文件
xml:11个
jar:9个
html:7个
4星 · 超过85%的资源 需积分: 10 573 下载量 134 浏览量
2009-09-05
08:55:34
上传
评论 4
收藏 6.71MB RAR 举报
温馨提示
使用flex+struts2+spring简单整合,前后台使用httpService通信,而且是分工程管理,使用了简单的封装,放到eclipse中即可运行。看好了,不是SSH,想弄的话自己再继续做,还什么东西都想拿现成的啊。
资源推荐
资源详情
资源评论
收起资源包目录
flex+struts2+spring(1).rar (73个子文件)
flex
.flexProperties 150B
bin-debug
AC_OETags.js 8KB
flex.swf 238KB
history
history.css 371B
history.js 24KB
historyFrame.html 807B
css
FlexStyle.css 32B
LnkgStyle.css 1KB
login.swf 238KB
login.html 4KB
flex.html 4KB
struts
AC_OETags.js 8KB
history
history.css 371B
history.js 24KB
historyFrame.html 807B
login.swf 381KB
login.html 4KB
playerProductInstall.swf 657B
playerProductInstall.swf 657B
src
flex.mxml 140B
ui
util
HttpServiceUtil.as 2KB
css
FlexStyle.css 32B
struts
model
UserModel.as 367B
login.mxml 1KB
actionscript
login.as 1KB
.actionScriptProperties 932B
html-template
AC_OETags.js 8KB
history
history.css 371B
history.js 24KB
historyFrame.html 807B
index.template.html 4KB
playerProductInstall.swf 657B
.settings
org.eclipse.core.resources.prefs 88B
libs
.project 467B
struts2
src
com
struts-default.xml 3KB
tools
converter
DateConverter.java 1KB
test
applicationContext.xml 361B
model
LoginModel.java 379B
sqlmap
action
LoginAction-validation.xml 910B
LoginAction.java 1000B
service
xwork-conversion.properties 87B
struts.xml 329B
struts.properties 694B
test
.classpath 533B
build
classes
com
struts-default.xml 3KB
tools
converter
DateConverter.class 2KB
test
applicationContext.xml 361B
model
LoginModel.class 741B
sqlmap
action
LoginAction-validation.xml 910B
LoginAction.class 2KB
service
xwork-conversion.properties 87B
struts.xml 329B
struts.properties 694B
test
.settings
org.eclipse.wst.common.project.facet.core.xml 269B
org.eclipse.jst.common.project.facet.core.prefs 364B
org.eclipse.wst.common.component 442B
org.eclipse.jdt.core.prefs 330B
WebContent
META-INF
MANIFEST.MF 39B
login.jsp 550B
error.jsp 318B
welcome.jsp 404B
WEB-INF
config
applicationContext-webapp.xml 339B
lib
struts2-spring-plugin-2.0.11.jar 9KB
xwork-2.0.4.jar 445KB
spring-2.5.6.jar 2.81MB
commons-logging-1.1.jar 52KB
struts2-core-2.0.11.jar 2.22MB
freemarker-2.3.8.jar 784KB
jsonplugin-0.30.jar 43KB
ognl-2.6.11.jar 164KB
json-lib-2.2.2-jdk15.jar 141KB
web.xml 1012B
.project 852B
共 73 条
- 1
zhangchuanfu
- 粉丝: 7
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
前往页