This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Global Exception handling issue in Struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Global Exception handling issue in Struts2" Watch "Global Exception handling issue in Struts2" New topic
Author

Global Exception handling issue in Struts2

leo jacob
Greenhorn

Joined: May 02, 2011
Posts: 17
Hi,

I am working on struts2 app. I have configured few global exceptions (500, 404, java.io.FileNotFoundException,java.io.IOException) in web.xml file.
It is working fine in Mozilla browser but in other browsers it is not working i.e. chrome,Internet Explorer 8,9 etc. Here it is showing "The website cannot display the page" for 500 error.

Also i will appreciate if any one can provide any link to explore global exception in struts 2.
Any help is highly appreciable

Thanks in Advance
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Add these lines in struts.xml

<global-results>
<result name="exception">jsp/common/error.jsp</result>
</global-results>

<global-exception-mappings>
<exception-mapping exception="java.lang.Exception"
result="exception" />
</global-exception-mappings>


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
leo jacob
Greenhorn

Joined: May 02, 2011
Posts: 17
Mohana Rao wrote:Add these lines in struts.xml

<global-results>
<result name="exception">jsp/common/error.jsp</result>
</global-results>

<global-exception-mappings>
<exception-mapping exception="java.lang.Exception"
result="exception" />
</global-exception-mappings>




Thanks Mahana!

I have done the same but still i am facing the same issue.
 
Don't get me started about those stupid light bulbs.
 
subject: Global Exception handling issue in Struts2
 
Similar Threads
Struts2
In struts2
Struts2 customized Exception handler
Struts2
struts2 + interceptor