본문 바로가기

기존카테고리/JSP_basic

에러페이지 처리



web.xml


<?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>studyjsp</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/404code.jsp</location>

  </error-page>

  <error-page>

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

    <location>/error/500code.jsp</location>

  </error-page>

  

</web-app>



--------------------------------------------


404code.jsp

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

    pageEncoding="UTF-8"%>

<% response.setStatus(HttpServletResponse.SC_OK); %>

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Insert title here</title>

</head>

<body>

404에러에요.~~

</body>

</html>



---------------------------------------------------


500code.jsp

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

    pageEncoding="UTF-8"%>

<% response.setStatus(HttpServletResponse.SC_OK); %>

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Insert title here</title>

</head>

<body>

500에러에요.~~

</body>

</html>





'기존카테고리 > JSP_basic' 카테고리의 다른 글

자바빈  (0) 2017.06.28
forward 액션태그  (0) 2017.06.28
include 액션태그(jsp:include)  (0) 2017.06.28
config 내장객체  (0) 2017.06.28
application 내장객체  (0) 2017.06.28