今天使用<html:messages>出现奇怪错误,大家进来帮帮忙。
今天使用 <html:messages> 在JSP页面上显示消息:
ACTION文件
ActionMessages actionMessages = new ActionMessages();
actionMessages.add( "messageReplySuccess ", new ActionMessage( "messager.action.messageReply.messageReplySuccess "));
saveMessages(request, actionMessages);
return mapping.findForward( "success ");
JSP文件
<html:messages id= "notice " property= "messageReplySuccess " message= "true ">
<bean:write name= "notice "/>
</html:messages>
struts-config.xml
<!--message reply initial-->
<action path = "/mesReplyInit "
type = "messager.messageReply.MessageReplyInitAction "
name = "messageReplyForm "
scope = "session "
validate = "false "
input = "/jsp/MessageAdmin.jsp ">
<forward name= "success " path= "/jsp/MessageReply.jsp " />
<forward name= "fail " path= "/jsp/MessageReply.jsp " />
</action>
<!--message reply -->
<action path = "/messageReply "
type = "messager.messageReply.MessageReplyAction "
name = "messageReplyForm "
scope = "session "
validate = "true "
input = "/jsp/MessageReply.jsp ">
<forward name= "success " path= "/jsp/MessageReply.jsp " />
<forward name= "fail " path= "/jsp/MessageReply.jsp " />
</action>
画面启动过程是:先走一个初始化ACTION,然后到JSP画面,用户点击按钮提交后进入
另一个ACTION(在这个ACTION里把ACTIONMESSAGE加到request),然后返回这个画面。
错误提示:
javax.servlet.ServletException: Cannot find bean: "notice " in any scope
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.jsp.MessageReply_jsp._jspService(MessageReply_jsp.java:441)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
messager.util.SetEncodingFilter.