I'm getting an NPE in the generated JSP/Java whenever I try to display both
an errors and messages queue on a JSP page.

I image it is something pretty embarrasingly simple, but I've been after it
for over a day. Thanks in advance

Here's the NPE:

  java.lang.NullPointerException
    at java.util.Hashtable.put(Hashtable.java:389)
    at
org.apache.jasper.runtime.PageContextImpl.setAttribute(PageContextImpl.java:
229)
    at
org.apache.struts.taglib.html.MessagesTag.doStartTag(MessagesTag.java:250)
    at org.apache.jsp.ContactUs$jsp._jspService(ContactUs$jsp.java:873)
    ...

The generated JSP Java code fragment is:
   ...
   try {
     int _jspx_eval_html_messages_1 = _jspx_th_html_messages_1.doStartTag();
     if (_jspx_eval_html_messages_1 !=
javax.servlet.jsp.tagext.Tag.SKIP_BODY) {, like
   ...

Here are the tags in my page (its the second "<html:messages tage" - where
this occurs
        ...
        </html:form> </td>

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

My action does a save on both the ActionErrors and ActionMessages objects,
though only one should actually end up with a message in it.
   ...
     messages.add(
       ActionMessages.GLOBAL_MESSAGE,
       new ActionMessage("msg.email.sent"));
     System.err.println("... Retrieved all fields from form");
   } catch (Exception e) {
     System.err.println("Error trying to send email");
     success = false;
     errors.add(
       ActionMessages.GLOBAL_MESSAGE,
         new ActionError("error.email.not.sent"));
       throw e;
   } finally {
     System.err.println("... Finished one way or the other.");
     saveMessages(request,messages);
     saveErrors(request,errors);
   }
   ...

Thanks again for any ideas -

Richard Mixon
email: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to