报如下错误信息
type Exception reportmessage Internal Server Errordescription The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.exception java.lang.IllegalStateException

解决方案 »

  1.   

    try
    {
      age=Integer.parseInt(str_age);
    }
      catch(NumberFormatException e)
     {
        
       response.sendRedirect("age_exception.jsp");
     }
    catch(IllegalStateException ee)
     {
        
       response.sendRedirect("age_exception.jsp");
     }
      

  2.   

    在jsp页面中是不能用try-catch的,jsp提供了另外一种机制来处理jsp页面中的异常,就是再引入个出错显示页面。
    1.在可能出错的页面的头部加上:<%@ page errorPage=”error/ExceptionPage.jsp” %>2.定义页面ExceptionPage.jsp
    <%@ page session=”false” isErrorPage=”true” import=”java.io.PrintWriter” %>
    <%-- Using the implicit variable EXCEPTION extract the name of the exception --%>
     <%
     String expTypeFullName
     = exception.getClass().getName();
     String expTypeName
     = expTypeFullName.substring(expTypeFullName.lastIndexOf(“.”)+1);
     String request_uri
     = (String) request.getAttribute(“javax.servlet.error.request_uri”);
     %> <HTML> <HEAD>
     <TITLE>JSP Exception Page</TITLE>
     </HEAD>