Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem to call errorpage in jsp

 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[code for jsp]

<%@ page language="java"%>
<%@ page errorPage="errorpage.jsp"%>
<%
String[] str={"Arun","Kumar","maalik"};
String str1=request.getParameter("script");
int n=Integer.parseInt(str1.trim());
out.println(str[n]);
%>
[/code]
-----------------------------------------------------------

[code for errorpage]

<%@ page isErrorPage="true"%>

<%=exception.getClass()%>
<%=exception.getMessage()%>

[/code]
------------------------------------------------
[code gor user input]
<html>
<body bgcolor=#87FFFF>
<form name="f1" action="test1.jsp">
<table>
<tr>
<td>Enter script number</td>
<td><input type=text name="script"></td>
</tr>

<tr>
<td><input type=submit value="OK"</td>
</tr>
</table>
</form>
</body>
</html>
[/code]
-----------------------------

Dear sir i have deployee all above three file within same context root. I am using the sun microsystem deployment tool.
As swon by code when i am sending array subscript 4 or 5 (any number except 0,1,2) it is not calling errorpage, can you tell me what wrong with my code. when i am sending number within array limit it is working fine. But when i am sending number out of limit browser showing error mesage as follow



The page cannot be displayed
There is a problem with the page you are trying to reach and it cannot be displayed.

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

Please try the following:

Open the localhost:8080 home page, and then look for links to the information you want.
Click the Refresh button, or try again later.

Click Search to look for information on the Internet.
You can also see a list of related sites.

HTTP 500 - Internal server error
Internet Explorer

what wrong with me sir? would you please tell me?

with regard

Arun kumar maalik
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MSIE, by default, does not show you the error screen generated by the server.
It sees the 500 response code and shows you it's own page.

To disable this, go to Tools -> Options -> Advanced (tab), and uncheck the "Show Friendly HTTP Errors" checkbox. You might need to restart MSIE or Windows to get this to take.
 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks sir thank a lot.as you told me i did same work and it is working now.

thanks
Arun kumar maalik
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic