in my browser when i call /i.jhtml where the file i.jhtml is not actually present it should display page not found.jsp file instead of this it displays a blank page on the browser. how can i solve this problem.
i think it is able to find valid mapping in *.jhtml web.xml specified above because of this reason it is displaying blank page instead of pagenotfound.jsp but if say like i.jtml then it displays pagenotfound.jsp but i want this page to be displayed even when i call i.jhtml wher the file i.jhtml is not existing. can any body help me in solving this issue.
Thanks [ March 02, 2008: Message edited by: raja ram ]
Joined: Aug 11, 2007
Hi raja !!!
You are using the Struts framework. In your webapp, all the requests with the extension ".jhtml" will be managed by the struts's Controller (org.apache.struts.ActionServlet).
That Servlet looks for valid mappings not in web.xml, but in a file generally called struts-config.xml If the mapping is not in the config'file, you will have a blank page.
When you are using Struts, the <error-page> won't get processed. You need to specify the error page redirection in struts-config.xml You can put it in <global-exceptions> in struts-config.xml You could configure it for java.lang.Exception. The 404 - Page not found would also be handled.
Make sure your config'file configured in web.xml :
Thanks for the reply can any one please let me know how to use <global-exceptions> in struts-config.xml with some example code
In struts-config.xml, we declare <global-exceptions> in the following format:
Here we are declaring that any Action (or business logic) that throws the SystemException will be sent to systemError.jsp. We are associating the error.system.crash message string from our SystemResource file with this exception.