首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > Ruby Rails >

errorPage展示不出来

2012-12-23 
errorPage显示不出来点击右边红色标题查看本文完整版:errorPage显示不出来--file:errhandler.jsp ? %@ pa

errorPage显示不出来
点击右边红色标题查看本文完整版:errorPage显示不出来

--file:errhandler.jsp
? <%@ page errorPage="errorpage.jsp" %>
? <%@ page language="java" %>
? <%@ page import= "java.util.*" %>
? <html>
? <body>
? <form method=post action="errhandler.jsp">
? What's the coolest programming language in the known universe?<p>
? Java<input type=radio name=language value="JAVA" checked>
? C++<input type=radio name=language value="CPP">
? Visual Basic<input type=radio name=language value="VB">
? C#<input type=radio name=language value="CSharp">
? <p>
? <input type=submit>
? </form>
? <%
? if (request.getMethod().equals("POST")) {
? if (request.getParameter("language").equals("JAVA")) {
? out.println("<hr><font color=red>You got that right!</font>");
? } else {
? throw new Exception("You chose the wrong language!");
? }
? }
? %>
? </body>
? </html>
?
? file:errorpage.jsp
?
? <%@ page isErrorPage="true" %>
? <html>
? <body>
? <h1>
? Error Page
? </h1>
? <hr>
? <h2>
? Received the exception:<br>
? <font color=red>
? <%=exception.getMessage()%>
? </font>
? </h2>
? </body>
? </html>
?
? tomcat 5.4中,errhandler.jsp可以显示,
? 若选择 java可看到 You got that right! 信息
? 若选择其它则ie中提示:
? 无法显示网页
? 您要访问的网页有问题,无法显示。
?
? 求解决办法!?????
?
------解决方法--------------------
改成runtimeexception试试
------解决方法--------------------
我记得exception接受的是runtimeexception.
? 如果你把
? throw new Exception("You chose the wrong language!");
? 改成 int a=10/0;
? 或者throw new RuntimeException("You chose the wrong language!");????
?

?

    

热点排行