how to print exception stack trace to web page?
import com.opensymphony.xwork2.ActionSupport;
import java.util.Arrays;
public class ExceptionAction extends ActionSupport
{
public String execute()
{
//
String errMsg = Arrays.toString(Thread.currentThread().getStackTrace());
this.addActionError(
"Unexcepted error has occurred. \n"
+errMsg
+ "\nPlease try again or report this error to administrator or support team. \n ");
return "error";
}
/**
*
*/
private static final long serialVersionUID = -3754090784536811052L;
}
but i got a useless msg use above codes, msg is like this:
[java.lang.Thread.getStackTrace(Thread.java:1479), com.monitoring.action.ExceptionAction.execute(ExceptionAction.java:11), sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method), sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39),