Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- property
- css
- 파일 입출력
- 윈도우 #단축키
- Method
- String
- javaservlet
- jQuery
- 다형성
- 데이터베이스
- 연산자
- array
- 연락처 프로그램
- 자바
- list
- 코틀린#클래스#상속
- kotlin #return #jump
- 오라클
- 상속
- function
- Java
- JavaScript
- jsp
- GUI
- html
- 설치
- springframework
- Event
- spring
- File 클래스
Archives
- Today
- Total
Binary World
JSP 에러 페이지 처리 본문
<Directive를 사용한 에러 페이지 처리>
- JSP를 실행하는 도중에 Exception이 발생하면 errorPage 속성에 지정된 페이지로 이동
<02_errorPage.html>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page errorPage="error.jsp" %> <%-- JSP를 실행하는 도중에 Exception이 발생하면 errorPage 속성에 지정된 페이지로 이동 --%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>JSP</title> </head> <body> <h1>Directive를 사용한 에러 페이지 처리</h1> <p> 나눗셈 결과: <%=(123/0)%></p> </body> </html> | cs |
<출력화면>
<03_errorPage.html>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>JSP</title> </head> <body> <h1>배포 관리자(web.xml)을 사용한 에러 페이지 처리</h1> <a href="none.jsp">파일이 없는 링크(404 에러)</a> <p>계산 결과: <%=(123/0) %></p> </body> </html> | cs |
<web.xml>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> <display-name>WEB07_JSP1</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <error-page> <error-code>404</error-code> <location>/error/code404.jsp</location> </error-page> <error-page> <error-code>500</error-code> <location>/error/code500.jsp</location> </error-page> </web-app> | cs |
<츨력화면>
'개발자의 길 > JSP' 카테고리의 다른 글
JSP include Directive(지시자) (0) | 2017.04.12 |
---|---|
JSP 동작원리 및 구성 요소(TAG) (0) | 2017.04.12 |
<이클립스> JSP 파일 생성 시 포멧 변경하기 (0) | 2017.04.12 |
Comments