我在web.xml里指定了page-error
然后在显示异常的页面<%@ page language="java" pageEncoding="utf-8"%>
<%@ page isErrorPage="true" %>
<%
out.print(exception.toString());
out.print(exception.getMessage());
out.print(exception.getLocalizedMessage());
exception.printStackTrace();
%>但是在页面只输出了几行数据,myeclipse的console里却输出了一大串,那一大串怎样输出到jsp去啊??

解决方案 »

  1.   

    try{}catch(Execption e)finally{}这样将错误信息打印出来
      

  2.   

    不理解~  jsp页面输出异常干嘛 ~ 你可以尝试把exception.printStackTrace(); 保存在String 然后看看能输出来不。。
      

  3.   

    这样:<%
    exception.printStackTrace(out);
    %>
      

  4.   

    这样不行啊,直接编译报错了,提示
    The method printStackTrace(PrintStream) in the type Throwable is not applicable 
     for the arguments (JspWriter)
      

  5.   

    exception.printStackTrace()打印出来的东东怎样保存到String嘛。。
      

  6.   

    那就写
    <% exception.printStackTrace(response.getWriter());%>
      

  7.   

    搜到了,就是这个
    exception.printStackTrace(new java.io.PrintWriter(out));