java Exception 错误 转为字符串 换行
来源:互联网 发布:09淘宝店 编辑:程序博客网 时间:2024/04/24 06:00
<%@page pageEncoding="UTF-8" %>
<%@page import="java.io.Writer"%>
<%@page import="java.io.PrintWriter"%>
<%@page import="java.io.StringWriter"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>ERROR</title>
</head>
<body>
<%
String info="";
StringWriter writer=null;
try{
Exception exception = new Exception("错误。");
writer = new StringWriter();
exception.printStackTrace(new PrintWriter(writer));
info = writer.getBuffer().toString();
info = info.replace("\n","<br> ");
}catch(Exception e)
{}
finally{
if(writer != null)
try {
writer.close();
}catch (Exception e) {
e.printStackTrace();
}
}
%>
异常对象: <s:property value="exception"/><br>
异常堆栈信息:<br>
<%=info %>
<s:property value="exceptionStack"/>
</body>
</html>
<%@page import="java.io.Writer"%>
<%@page import="java.io.PrintWriter"%>
<%@page import="java.io.StringWriter"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>ERROR</title>
</head>
<body>
<%
String info="";
StringWriter writer=null;
try{
Exception exception = new Exception("错误。");
writer = new StringWriter();
exception.printStackTrace(new PrintWriter(writer));
info = writer.getBuffer().toString();
info = info.replace("\n","<br> ");
}catch(Exception e)
{}
finally{
if(writer != null)
try {
writer.close();
}catch (Exception e) {
e.printStackTrace();
}
}
%>
异常对象: <s:property value="exception"/><br>
异常堆栈信息:<br>
<%=info %>
<s:property value="exceptionStack"/>
</body>
</html>
- java Exception 错误 转为字符串 换行
- Java将Exception信息转为String字符串
- Java, 文本文件转为字符串
- java 字符串转为整型
- java字符串转为数组
- Java中将字符串转为日期
- java科学计数转为字符串
- java 字符串转为基本数据类型
- 读取文件转为java字符串
- java中printStackTrace转为字符串
- json字符串转为java类
- Eclipse 报 “Exception in thread "main" java.lang.OutOfMemoryError: Java heap space ”错误的解决办法以及文本文件换行
- Java 字符串或字符串数组转为 List
- java将exception的stack trace 转为string
- Java 处理字符串中的换行
- java中error错误和Exception错误
- 字符串转为date格式(java)
- JAVA GBK 字符串转为utf-8
- 看论坛上的一个帖子有感
- Android--SQLite学习及使用方法
- 【骚男崛起】女人们已无法阻止男人的妖媚了!小苏有朋遭禁播性感舞曲MV流出
- linux中的.....cp tar touch makdir
- android message机制
- java Exception 错误 转为字符串 换行
- 数组名与指针
- 使用Intel编译器(5)PGO(3)评测函数或循环执行时间(Profile Function or Loop Execution Time)
- 大相面
- C#TreeView窗体版点击右键弹出菜单+直接修改名称+新建节点
- SQL Server 2008 R2:纯SQL查看数据库描述文档
- Hibernate核心接口和类
- 今天经过一场深有体会的谈话-终于决定了我2012的方向
- 让程序实现xp界面风格