This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp error page is not working

 
bhushana rao
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the servlets forum since this is all spec driven and is not specific to Tomcat.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64978
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .
 
Rahul Siddharth
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am assuming you are using Internet Explorer and the settings to show friendly error messages is checked. you need to uncheck it.
 
Rahul Siddharth
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bello............Thanks a ton man!!.It's working with Mozilla.
 
bhushana rao
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bosum.......
now it is working
jsp error page
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic