struts初级问题,页面的错误信息显示不出来
java代码
ActionMessages errors = new ActionMessages();
errors.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage( "error.admin.accessDeny "));
if(!errors.isEmpty()){
saveErrors(request,errors);
}
配置文件
ApplicationResources_zh.properties
error.admin.accessDeny = UserName Or PassWord error.
struts-config.xml
<global-forwards >
<forward name= "ToErrorPage " path= "/common/messagepage.jsp " redirect= "true "/>
</global-forwards >
<message-resources parameter= "chojo.ApplicationResources_zh " />
messagepage.jsp里是
<%@ page contentType= "text/html;charset=gb2312 " language= "java "%>
<%@ include file= "/common/taglibs.jsp "%> <head>
<title>
消息页面
</title>
</head>
<html:html>
<body>
<center>
<html:errors />
<h2>
<a href= "javascript:history.go(-1) ">
返回上一页
</a>
</h2>
</center>
</body>
</html:html>
为什么messagepage.jsp不显示我设置的错误信息呢.求解......
------解决方案--------------------只有执行动作才会执行action
------解决方案--------------------你有动作,但是你没执行!就是说你这个Action没有执行!
------解决方案--------------------struts-config.xml文件中没有配置action