개발/백

[JSP] jsp에서 e.printStackTrace 출력하기

다당근 2021. 11. 2. 13:09

 

 

jsp에서 e.printStackTrace 출력하는 방법

 

 

<%
  try{

  }catch(Exception e){

      ByteArrayOutputStream bs = new ByteArrayOutputStream();
      PrintStream printStream = new PrintStream(bs);
      e.printStackTrace(printStream);
      String traceStr = bs.toString();

      System.out.println(traceStr);

  }
%>

 

스크립트릿 안에 해당 코드를 넣으면 된다.

스크립트릿이 뭔지 모른다면 클릭