STRUTS: Problem with ActionMessages ! Please help !


Web tier: servlets, JSP, Web frameworks: STRUTS: Problem with ActionMessages ! Please help !

  1. Hi all,

    My ActionMessages use to work perfectly, then about a week ago i only picked up that they stopped working, and now i cant find out what the problem is with them.

    Here is the code for creating them in my action class :

    ActionMessages messages = new ActionMessages();
    ActionMessage msg = new ActionMessage
    messages.add(ActionMessages.GLOBAL_MESSAGE, msg);
    saveMessages(servletRequest, messages);

    And in my jsp :

    <logic:messagesPresent message="true">
       <html:messages id="message" message="true">
          <bean:write name="message" />


    Now when a user is added to the system to forwards back the the original page, and displays the message at the top.

    The first time the page is loaded everything works(no message yet) then the user gets added and forwarded back to the add page, but then the page crashes with the following message in jboss :

    12:49:17,812 INFO [ManageNewUserAction] created
    12:49:17,812 INFO [ManageNewUserAction] no errors
    12:49:17,812 INFO [ManageNewUserAction] hi3
    12:49:17,843 ERROR [Engine] ApplicationDispatcher[/webmodule] Servlet.service() for servlet jsp thre
    w exception
    javax.servlet.jsp.JspException: Cannot find bean message in any scope
            at org.apache.struts.taglib.TagUtils.lookup(
            at org.apache.struts.taglib.bean.WriteTag.doStartTag(
            at org.apache.jsp.mainLayout_jsp._jspx_meth_bean_write_0(
            at org.apache.jsp.mainLayout_jsp._jspService(
            at org.apache.jasper.runtime.HttpJspBase.service(
            at javax.servlet.http.HttpServlet.service(
            at org.apache.jasper.servlet.JspServletWrapper.service(
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(
            at org.apache.jasper.servlet.JspServlet.service(
            at javax.servlet.http.HttpServlet.service(

    The messages is added to my request scope, so the problem is`nt there. And this message only comes up if the message is actually in the scope.

    I have no idea what to do anymore, any help would be appriciated.

  2. Just had the same. First, check that all tags that you are using on the page, are properly declared on top of the page. Then turn on reporting for missing messages in your struts-config.xml: <message-resources null="false" /> If Struts is unable to find message, it will show something like ???KEY???. If you see this, that means that your property names are different from message IDs in your app.
  3. Yes this is spot on. We need to make sure that all keys that we adding to action messages are present in files. This will fix the problem.

    <message-resources parameter="content.Language" null="false"></message-resources>

    can show info of missing keys as pointed by previous post.