• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Query related to Error Pages

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 156
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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


error.jsp
<html><body><h1><font color=red>java.lang.Throwable Error Page</font></body></h1>



errortest.jsp

<html>
<body>
This is the content before generating error
${1 mod 0}
</body>
</html>



TestServlet.java

public class TestServlet extends HttpServlet {
public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException{
RequestDispatcher rd=request.getRequestDispatcher("errortest.jsp");
rd.forward(request,response);
}
}

 
Amit Tayal
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am using the beta version of IE 7.0


Mouarf Don't try things with crap
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic