| Author |
Query related to Error Pages
|
Amit Tayal
Ranch Hand
Joined: Apr 25, 2006
Posts: 51
|
|
Hi All I am facing an issue while using the catch all error page. I have declaeted the cat all erro page in DD using below mentioned code: <error-page> <exception-type>java.lang.Throwable</exception-type> <location>/error.jsp</location> </error-page> Now when even I am acessing an JSP page say "Name.jsp" (directly through URL), browser shows the above mentioned error page in case of any runtime error. I am generating the error in jsp using code: ${1 mod 0} But whenever I forward the request to Name.jsp from any servlet the error page is not coming up. I am getting the message on browser: The website cannot display the page HTTP 500 Most likely causes: The website is under maintenance. The website has a programming error. Please let me know the difference for the same. Thanks in advance Amit
|
 |
Rahul Mahindrakar
Ranch Hand
Joined: Jul 28, 2000
Posts: 1831
|
|
Hi Amit The message below that is appearing The website cannot display the page HTTP 500 Most likely causes: The website is under maintenance. The website has a programming error. Where is it coming from. Is it a jsp page somewhere or what as this is not a standard message on the browser.
|
 |
Amit Tayal
Ranch Hand
Joined: Apr 25, 2006
Posts: 51
|
|
Hi Rahul In the code I am calling a servlet and that servlet in internally forwarding the request to JSP page. This jsp page contains the source of exception i.e ${1 mod 0} Amit
|
 |
santhoshkumar samala
Ranch Hand
Joined: Nov 12, 2003
Posts: 156
|
|
Hi I have tried the same example with tomcat 5.x, both times I am able to send it to error.jsp. My servlet is forwarding the page to corresponding jsp. for your reference I am giving my code, still if you face the problem please post your servlet code
errortest.jsp
<html> <body> This is the content before generating error ${1 mod 0} </body> </html>
TestServlet.java
|
santhosh<br />SCJP,SCWCD
|
 |
Amit Tayal
Ranch Hand
Joined: Apr 25, 2006
Posts: 51
|
|
Hi Santosh I am still getting the same old error. Please have a look at the code once. Given below is the code for Servlet and JSP: BeerSelect.java ======================= import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; public class BeerSelect extends HttpServlet { public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException { RequestDispatcher fw=request.getRequestDispatcher("test.jsp"); fw.forward(request,response); } public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException { doPost(request,response); } } test.jsp ======================== <html> <body> <h1>Error Testing Page</h1> ${1 mod 0} </body> </html> error.jsp ====================== <%@ page isErrorPage='true' %> <html> <body> <h1>error page123456</h1> </body> </html> Code in Web.xml ======================== <error-page> <exception-type>java.lang.RuntimeException</exception-type> <location>/error.jsp</location> </error-page> <error-page> <exception-type>java.lang.Throwable</exception-type> <location>/error.jsp</location> </error-page>
|
 |
Amit Tayal
Ranch Hand
Joined: Apr 25, 2006
Posts: 51
|
|
Hi Santhosh The issue is resolved. I am using the beta version of IE 7.0. I think it might be the reason of error. I ran the same code in netscape and it went fine. Thanks to all. Amit
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14685
|
|
I am using the beta version of IE 7.0
Mouarf Don't try things with crap
|
[My Blog]
All roads lead to JavaRanch
|
 |
 |
|
|
subject: Query related to Error Pages
|
|
|