File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Global excpetion-getting print stack trace?

 
sudhakar Tadepalli
Ranch Hand
Posts: 130
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to get print stack trace from exception object i am throwing from the action class, which was declared in the global-exception section of the struts-config.xml file.When i get exception,it is forwarding to error.jsp and printing message from Application.resourceProperties file. But i also want to print Exception message on the error.jsp and the stack trace.I have exception object in the request scope .Please see the sample code

Struts-config.xml :

<global-exceptions>
<exception key="errors.nullpointer" type="java.lang.NullPointerException" path="page.error" scope="request"/>
<exception key="errors.exception" type="java.lang.Exception" path="page.error" scope="request" />
</global-exceptions>

//error.jsp

<HTML>
<BODY>
<%@ page isErrorPage="true" %>

<P>
reported the following error:

<logic:messagesPresent>
<UL>
<html:messages id="error">
<LI><font color="RED"><bean:write name="error" /></font></LI>
</html:messages>
</UL>
</logic:messagesPresent>

</BODY></HTML>

Thanks
Sudhakar
 
sudhakar Tadepalli
Ranch Hand
Posts: 130
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still waiting trying to solve this, any help please?

-Sudhakar
 
sudhakar Tadepalli
Ranch Hand
Posts: 130
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The current jsp page is showing a message from Application properties file.
I am trying to print generic message on error page. If I put the following line in error.jsp i am getting [ServletException in:/error.jsp]null message.

<font color="red">
<%= exception.toString() %><br>
</font>

-Sudhakar
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic