近日项目中出现问题:
1 jsp 页面将 BigDecimal 输出
2 jsp 页面将 Date 格式化输出(页面有时间转换器,但与当前页面要转格式不同)
同事们使用 Struts2 的国际化解决了这个问题.小节一下 Strust2 中的国际化.
小结了一下 Java 中国际化的相关内容. 同时总结了 Struts 2 国际化的使用,特别是 占位符的使用.
userName=nowName
date=nowDate
userNameError=userName is not null
dateError=date is not null
nowTime=now time {0, date, yyyy-MM-dd HH\:mm\:ss}
successInfo=now user {0} login success.
另一个文件就不多说了.
2页面中的使用:
request_locale 存在于Struts2 的拦截器中,通过此方法设置其 request_locale 可达到更改语言的目的
3 Action 的中的使用
date = new Date();
// ActionSupport.getText() 可以使用 getText 获得资源文件
// message = getText("userName");
// 占位符的使用
// List list = new ArrayList();
// list.add("myTest");
// message = getText("successInfo", list);
// message = getText("successInfo",new String[]{"myTest"});
message = getText("successInfos", "出错了", new String[] { "myTest" });
4 占位符在 JSP 页面的使用
分享到:
2009-11-20 18:02
浏览 1383
评论