public doSomthing() throws Exception {...}public static void main(String[] args) {try {
doSomthing();
}
catch(Exception e)
System.out.println("doSomthing error occured");
}
doSomthing();
}
catch(Exception e)
System.out.println("doSomthing error occured");
}
<% page errorPage="error.jsp"%>
在error.jsp内加上
<% page isErrorPage="true" %>
就可以使用exception对象了,比如可以
<%=exception%>
<%exception.printStackTrace(new PrintWriter(out));%>