Hello:

I declared an application error page in my web.xml:

  <error-page>
    <exception-type>java.lang.Throwable</exception-type>
    <location>/error.action</location>
  </error-page>

I have this declaration in my struts.xml:

    <action name="error" class="page.Error">
      <result name="success" type="tiles">error</result>
    </action>

In my page.Error class, I am trying to get the exception
that was thrown:

public class Error extends ActionSupport {
  public String execute() {
    PageContext pageContext = ServletActionContext.getPageContext();
    if( pageContext != null ) {
      Exception exception = pageContext.getException();
      if( exception != null ) {
        Logger.getLogger(getClass()).error(exception);
      }
    } else {
      Logger.getLogger(getClass()).debug("Page context is null");
    }
    return SUCCESS;
  }
}

But, when the action executes, the pageContext is always null.

What can I do to get the exception that was thrown?

Thanks,
        Neil

--
Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.


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

Reply via email to