<%--
-초기화 파라미터는 web.xml에 작성합니다.
getInitParameternames() :
웹 어플리케이션 초기화 파라미터의 이름 목록을 리턴합니다.
getInitParameter(Name) :
이름이 Name인 웹 어플리케이션 초기화 파라미터의 값을 읽어온다.
존재하지 않을 경우 null을 리턴한다.
--%>
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
|
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Application Test - 초기화 파라미터 읽어오기</title>
</head>
<body>
<!-- application 객체는 웹 어플리케이션 전반에 걸쳐서 사용되는 정보를 담고 있습니다. -->
<h2>초기화 파라미터 목록</h2>
<ul>
<%
Enumeration<String> initp =application.getInitParameterNames();
while(initp.hasMoreElements()){
String pname = initp.nextElement();
%>
<li>
<%=pname %>=
<%=application.getInitParameter(pname) %>
</li>
<%} %>
</ul>
</body>
</html>
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4f; text-decoration:none">Colored by Color Scripter
|
결과화면
web.xml 내용 일부
1
2
3
4
5
6
7
8
9
10
11
12
|
<!--파라미터 이름이 logEnabled이고 파라미터 값이 "true"인 초기화 파라미터 추가 -->
<context-param>
<description>로깅 여부</description>
<param-name>logEnabled</param-name>
<param-value>true</param-value>
</context-param>
<!--파라미터 이름이 debugLevel이고 파라미터 값이 "5"인 초기화 파라미터 추가-->
<context-param>
<description>디버깅 레벨</description>
<param-name>debugLevel</param-name>
<param-value>5</param-value>
</context-param>
Colored by Color Scripter
|
'IT > JSP' 카테고리의 다른 글
config (0) | 2019.05.13 |
---|---|
jsp만 이용해서 로그인처리하기 (0) | 2019.05.13 |
web.xml 설정 (0) | 2019.05.13 |
application (0) | 2019.05.13 |
페이지 이동하는 두 가지 방법 (redirect, dispatcher) (0) | 2019.05.13 |