File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes jsp error page is not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "jsp error page is not working" Watch "jsp error page is not working" New topic
Author

jsp error page is not working

bhushana rao
Greenhorn

Joined: Jun 02, 2008
Posts: 25
I am using Tomcat 6.0

i have created application SampleError in webapps
in that i have three files
LoginPage.jsp
which reads two text data one is id and other is password
i have converted string id value to int value in AuthenticatCustomer.jsp
when ever NumberFormatExceptin occurs i specify errorPage as LoginErroPage.jsp
but
when NumberFormatException occurs it is showing
page cannot be displayed

is there any additional path setting to execute it or error in my files please tellme
<html>
<body>
<form name="f1" action="AuthenticateCustomer.jsp">
<font size=4 face="Verdana" color=#120292>
<marquee> Online Banking System </marquee>
<br>
<br>
<table cellspacing=5 cellpadding=5 bgcolor=#959999 colspan=2 rowspan=2 align="center">
<tr>
<td> Bank Customer Authentication Form</td>
</tr>
<tr>
<td>Enter Customer Id :</td>
<td><input type=text name="uname"></td>
</tr>
<tr>
<td>Enter Password: </td>
<td><input type=password name="password"></td>
</tr>
</table>
<br>
<table align="center">
<tr>
<td><input type="submit" value=" Login " ></td>
<td><input type="Reset" value=" Cancel " ></td>
</tr>
</table>
</font>
</form>
</body>
</html>

AuthenticatCusotmer.jsp
<%@ page errorPage="/LoginErrorPage.jsp" %>
<html>
<body>
<font face ="verdana">
<%
/* Retrieving the value of the uname text field */
String user=request.getParameter("uname");
/* Converting the string value into the integer value */
int customerID=Integer.parseInt(user);
/* Retrieving the value of the password text field */
String pass=request.getParameter("password");
/* Validate the customerID and password */
if( customerID== 1010 && pass.equals("Jackson"))
{
out.println("Welcome to Online Banking System");
%>
<br>
<br>
<%
out.println("Login Successful");
}
else
{
out.println("Login Unsuccessful");
}
%>
</font>
</body>
</html>

LoginErrorPage.jsp

<%-- Specify this is the error page --%>
<%@ page isErrorPage="true" %>
<html>
<body>
<h3> An exception has occurred</h3>
<table>
<tr>
<td>Exception Class:</td>
<%-- Obtain the name of exception class where 'exception' is the implicit object provided by JSP --%>
<td><%= exception.getClass() %></td>
</tr>
<tr>
<td>Message:</td>
<%-- Obtain the exception message where 'exception' is the implicit object provided by JSP --%>
<td><%= exception.getMessage() %></td>
</tr>
</table>
<br>
To go back to the login page click Login Page button
<form name="f2" action="LoginPage.htm">
<input type="submit" name="button1" value="Login Page">
</form>

</body>
</html>
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Moving to the servlets forum since this is all spec driven and is not specific to Tomcat.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extermely hard to read and many people that might be able to help you will just move along. Please read this for more information.

You can go back and change your post to add code tags by clicking the .


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rahul Siddharth
Ranch Hand

Joined: Feb 17, 2007
Posts: 33
Hello Everyone.I had a similar problem.

My index page(index.jsp) was:
----------------------------------------------------------

-----------------------------------------------------------

I tried to post to formHandler.jsp which throws an exception.

formHandler.jsp
-----------------------------------------------------------

---------------------------------------------------------------
The ExceptionHandler is

exceptionHandler.jsp
---------------------------------------------------------------

---------------------------------------------------------------
when I run this application I could see the debugging statement "im here at the exception handler" printed on the log.But my JSP is not displayed with the welcome statement.I see the Internal Server Error.

Could someone please tell me if i'm missing something.

Thanks in Advance.
[ June 19, 2008: Message edited by: Rahul Siddharth ]
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
I am assuming you are using Internet Explorer and the settings to show friendly error messages is checked. you need to uncheck it.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Rahul Siddharth
Ranch Hand

Joined: Feb 17, 2007
Posts: 33
Bello............Thanks a ton man!!.It's working with Mozilla.
bhushana rao
Greenhorn

Joined: Jun 02, 2008
Posts: 25
Thanks Bosum.......
now it is working
jsp error page
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp error page is not working