(adsbygoogle = window.adsbygoogle || []).push({ google_ad_client: "ca-pub-8242763509535969", enable_page_level_ads: true }); [JSP] 웹 에러 페이지 /web error page 처리 :: 깜냥깜냥
weberror1.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
    <%@page isErrorPage="true" %>
    <%response.setStatus(200); %>
<!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=EUC-KR">
<title>Error</title>
</head>
<body>
<h2>!!!!!!!Error!!!!!!!</h2>
</body>
</html>




web.xml
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?xml version="1.0" encoding="UTF-8"?>
    id="WebApp_ID" version="3.1">
    <display-name>WebError</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>400</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>401</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>402</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>403</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>404</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>405</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>406</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>407</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>408</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>409</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>410</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>411</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>412</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>413</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>414</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>415</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>416</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>417</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>418</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>420</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>422</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>423</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>424</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>425</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>426</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>428</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>429</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>431</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>444</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>449</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>450</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>451</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>494</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>495</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>496</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>497</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>499</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>500</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>501</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>502</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>503</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>504</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>505</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>506</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>507</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>508</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>509</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>510</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>511</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>598</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
    <error-page>
        <error-code>599</error-code>
        <location>/weberror1.jsp</location>
    </error-page>
</web-app>


편의상 같은 jsp로 했지만  각각의 location 부분에  다른 파일을 넣어도 됩니다. 

test.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!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=EUC-KR">
<title>Test</title>
</head>
<body>
<%
int num=1004849932/0;
%>
</body>
</html>

 0을 나눈다는 개념은 틀린 것이니 당연히 에러가 나겠죠? 


이처럼 에러 코드 대신 내가 만들어 준 파일이 뜹니다.

+ Recent posts