if (!this.isTokenValid(request)) {
ActionErrors errors = new ActionErrors();
ActionMessages messages = new ActionMessages();
ActionMessage message = new ActionMessage("welcome.content");
// messages.add("aa", message);
errors.add("aa", message);
errors.add("aa",new ActionMessage("welcom.content---1",false));
// this.saveMessages(request, errors);
ActionMessage mess1 = new ActionMessage("输出错误信息!", false);
errors.add("bb", mess1);
this.saveErrors(request, errors);
//this.saveMessages(request,messages);
request.getRequestDispatcher("/show.jsp").forward(request, response);
return null;
}
struts1给程序提供了显示消息方式:
ActionErrors,和ActionMessages
saveErrors和saveMessages中保存在范围变量中属性值分别是:
public static final String MESSAGE_KEY =
"org.apache.struts.action.ACTION_MESSAGE";
public static final String ERROR_KEY = "org.apache.struts.action.ERROR";
界面显示:
<html:messages id="s" message="false" property="bb">
<bean:write name="s" /><br/>
</html:messages>
属性id:指定保存在范围变量中属性名
message指定保存时ActionErrors消息还是ActionMessages 默认是显示ActionMessages
属性property 指定显示ActionErrors 中指定属性名的消息。
errors.add("aa",new ActionMessage("welcom.content---1",false));
语句中false指明直接显示消息,而不是国际化资源文件中配置信息。
分享到:
相关推荐
struts1国际化的实例,里面有一个自己做的小web程序实现了中文和英文,内含说明书!
struts1 国际化 源代码 struts1 国际化 工程
struts1国际化网站中英文切换例子 登录窗体中英文切换例子
struts1.2
eclipse国际化插件jinto 博文链接:https://gdf84.iteye.com/blog/215239
整理struts2国际化例子源码整理struts2国际化例子源码整理struts2国际化例子源码
Struts1 和 Struts 2 国际化全局资源,有文档说明、有图形加以说明,还有源代码。
struts国际化struts国际化struts国际化
struts2国际化MyEclipse开发struts2国际化MyEclipse开发童叟无欺
Struts2国际化的实现原理;简单的struts2国际化实现过程的讲解
struts1 javaee j2ee mvc jsp框架 企业级软件开发
http://blog.csdn.net/liuhongjavaen/article/details/7655385 具体操作事项请查阅博客 struts2国际化源码 eclipse国际化插件
struts2国际化测试小demo
struts2国际化 标签 页面 处理类 实例,特殊注意点说明
当今很多网站都只针对本国网民使用,所以,为了跟随时代潮流,所有的网站要能够符合不同国家的人浏览》。。 当今很多网站都只针对本国网民使用,所以,为了跟随时代潮流,所有的网站要能够符合不同国家的人浏览》。...
struts国际化的描述,其中包括在配置文件中配置实现,以及在后台中或者是前台中处理实现国际化的过程。
经典的struts中文问题,国际化问题终极解决方案
struts2国际化,根据浏览器设置来显示不同语言,。
相关的国际化的知识点,写了一个小demo