달력

32024  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

'Programing/JSP'에 해당되는 글 1건

  1. 2016.11.16 web.xml error-page 설정

WEB-INF/Web.xml 파일에서 발생하는 에러에 대한 설정이 아래와 같이 가능하다


<error-page>

        <exception-type>com.lgcns.ncd.common.exception.AuthException</exception-type>

        <location>/WEB-INF/jsp/system/error/errorAuth.jsp</location>

    </error-page>


    <error-page>

        <error-code>404</error-code>

        <location>/WEB-INF/jsp/common/error/error404.jsp</location>

    </error-page>

    <error-page>

        <error-code>500</error-code>

        <location>/WEB-INF/jsp/common/error/error500.jsp</location>

    </error-page>


근데???? 크롬에서는 잘된다... 에러페이지 불러오기가


error404.jsp


<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>404 에러페이지 </title>

<script type="text/javascript">

alert('화면을 찾을 수 없습니다. \n이전 화면으로 돌아갑니다.');

history.back();

</script>

</head>

<body>


</body>

</html>


근데 익스플로러에서는 alert 메시지도 안나오고 이전화면으로도 돌아가지도 않고

익스플로러 전용의 404 화면을 보여준다...

뭐지 싶어서 찾아본 결과로는 

브라우저 마다  response. 코드 해석이 달라서 그렇다고 한다.

익스플로러에서도 내가 지정한 에러페이지에 대한 접근이 가능하게 하려면

보고 싶은 에러지정 페이지에

<%

response.setStatus(200);

%>

를 넣어주면 끝! 



<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%

response.setStatus(200);

%>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>404 에러페이지</title>

<script type="text/javascript">

alert('화면을 찾을 수 없습니다. \n이전 화면으로 돌아갑니다.');

history.back();

</script>

</head>

<body>


</body>

</html>


<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%

response.setStatus(200);

%>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>500 오류 페이지</title>

<script type="text/javascript">

alert('오류가 발생하였습니다. \n서비스 오류가 발생했습니다. 시스템 담당자에게 문의해 주세요.');

history.back();

</script>

</head>

<body>


</body>

</html>


Posted by 한설림
|