I am in the process of upgrading Struts from 1.0 to 1.2.7 Right now I am trying to change the error handling bit. However, I get the following error with the code changes I have made. Please let me know if any of you can figure out what can fix it.
MY CODE: In the Action Class
ActionMessages messages = new ActionMessages();
messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage
("error.warning", "Some Error String"));
saveMessages(request, messages);
return (mapping.findForward("error")); //redirects to error.jsp
MY CODE: error.jsp
<html:messages id="msss" message="true">
<li><bean:write name="msss" /></li>
</html:messages>
MY CODE: in ApplicationResources.properties
error.error =Error: {0}
error.warning =Warning: {0}
MY CODE: in struts-config.xml (reference to properties file)
<message-resources parameter="ApplicationResources"/>
ERROR I GET >>
javax.servlet.jsp.JspException: Cannot find bean msss in any scope at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:934)at org.apache.struts.taglib.bean.WriteTag.doStartTag
WriteTag.java:225) at _web_2d_inf._error._jspService(_error.java:116)[SRC:/WEB-INF/error.jsp:45]
<li><bean:write name="msss" /></li> --- Line # 45 in error.jsp
NOTE: If I dont use the Application Resources when creating the ActionMessage, and use a string instead .. It works!
ActionMessage ae1 = new ActionMessage("This is a ERROR", false); works
MY CODE: In the Action Class
ActionMessages messages = new ActionMessages();
messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage
("error.warning", "Some Error String"));
saveMessages(request, messages);
return (mapping.findForward("error")); //redirects to error.jsp
MY CODE: error.jsp
<html:messages id="msss" message="true">
<li><bean:write name="msss" /></li>
</html:messages>
MY CODE: in ApplicationResources.properties
error.error =Error: {0}
error.warning =Warning: {0}
MY CODE: in struts-config.xml (reference to properties file)
<message-resources parameter="ApplicationResources"/>
ERROR I GET >>
javax.servlet.jsp.JspException: Cannot find bean msss in any scope at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:934)at org.apache.struts.taglib.bean.WriteTag.doStartTag
WriteTag.java:225) at _web_2d_inf._error._jspService(_error.java:116)[SRC:/WEB-INF/error.jsp:45]
<li><bean:write name="msss" /></li> --- Line # 45 in error.jsp
NOTE: If I dont use the Application Resources when creating the ActionMessage, and use a string instead .. It works!
ActionMessage ae1 = new ActionMessage("This is a ERROR", false); works