본문 바로가기
IT/JSP

application

by dya0 2019. 5. 13.
 

getRealPath기억해두기

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
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
    <!-- application 객체는 웹 어플리케이션 전반에 걸쳐서 사용되는 정보르르 담고 있습니다.  -->
    <h2>application테스트</h2>
    <table border="1">
        <tr>
            <td>Servlet API 스펙의 버전</td>
            <td><%=application.getMajorVersion() %>.
                <%=application.getMinorVersion() %></td>
        </tr>
        <tr>
            <td>컨테이너 이름과 버전</td>
            <td><%=application.getServerInfo()%></td>
        </tr>
        <tr>
            <td>웹 어플리케이션의 실제 파일 시스템 경로</td>
            <td><%=application.getRealPath("/"%></td>
        </tr>
        <!-- getRealPath("/") : /는 context 경로입니다. 즉, 웹 애플리케이션 경로까지 구하라는 의미입니다. -->
    </table>
 
</body>
</html>
Colored by Color Scripter