public InputStream readFile(String path) {
File file = new File(path);
try {
return FileUtils.openInputStream(file);
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
以上是我的代码,我箱把catch()中的e信息显示到页面上怎么处理?在线等!file,异常
File file = new File(path);
try {
return FileUtils.openInputStream(file);
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
以上是我的代码,我箱把catch()中的e信息显示到页面上怎么处理?在线等!file,异常
PrintWriter pWriter = new PrintWriter(new CharArrayWriter());
e.printStackTrace(pWriter);//重定向到writer中
String exceptionInfo = pWriter.toString();
response.getWriter.println(exceptionInfo);//写到jsp页面
<!-- 定义错误页面 -->
<error-page>
<exception-type>com.ecp.util.ApplicationException</exception-type>
<location>/system_error.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/http_error404.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/http_error505.jsp</location>
</error-page>