sitelink1 | |
---|---|
sitelink2 | |
extra_vars5 | |
extra_vars6 |
web.xml이란
Deployment Descriptor로 각 어플리케이션의 환경을 설정하는 부분을 담당한다. WAR 파일이 패키지 될 때 같이 포함되며 root directory 밑에 /WEB-INF 디렉토리에 위치한다.
web.xml 의 구조
xml 정의와 schema 선언
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd> |
웹 어플리케이션의 환경 설정 <web-app>
<servlet>
<servlet-name>사용되는 클래스명</servlet-name>
<servlet-class>클래스 경로</servlet-class>
</servlet>
<mime-mapping>
<extension>txt</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
<welcome-file-list>
<welcome-file>기본 파일 경로</welcome-file>
<welcome-file>두번째 시작하는 파일 경로</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>태그라이브러리</taglib-uri>
<taglib-location>경로</taglib-location>
</taglib>
</web-app>
web.xml은 xml파일이다. 따라서 xml 작성과 동일한 규칙이 적용된다.
환경설정은 <web-app>으로 시작하고 </web-app>로 끝난다. 그외 삽입되는 요소로는 다음과 같다.
.ServletContext Init Parameters
.Session Configuration
.Servlet/JSP Definitions
.Servlet/JSP Mappings
.Mime Type Mappings
.Welcom File list
.Error Pages
web.xml의 elements의 순서
각 element의 순서는 아래 순서에 따른다.
<icon?>, <display-name?>, <description?>, <distributable?>, <context-param*>, <filter*>, <filter-mapping*>, <listener*>, <servlet*>, <servlet-mapping*>, <session-config?>, <mime-mapping*>, <welcome-file-list?>, <error-page*>, <taglib*>, <resource-env-ref*>, <resource-ref*>, <security-constraint*>, <login-config?>, <security-role*>, <env-entry*>, <ejb-ref*>, <ejb-local-ref*> |
자주 쓰이는 elements 예제
<?xml version="1.0" encoding="ISO-8859-1"?> <web-app> |
* 만약 톰캣 4에서 servelt에 접근이 안되는 경우
아래는 okjsp.pe.kr 운영자 kenu님의 처리 방법이다.
invoker 서블릿의 매핑이 보안문제로 막혀있어서 발생하는 문제로 $CATALINA_HOME/conf/web.xml를 열고 해당 부분의 주석을 제거한다. <!-- The mapping for the invoker servlet --> security-constraint 엘리먼트를 $CATALINA_HOME/conf/web.xml 파일의 welcome-file-list 엘리먼트 아래쪽 <web-app> 에 중첩되게 복사합니다. <welcome-file-list> |
web.xml 태그 작성 순서
http://java.sun.com/dtd/web-app_2_3.dtd
icon
display-name
description
distributable
context-param*
filter*
filter-mappiing*
servlet*
servlet-mapping*
session-config
mime-mapping
welcome-file-list
error-page*
tablib*
resource-env-ref*
reource-ref*
security-constraint*
login-coonfig
security-role
env-entry
ejb-ref
ejb-local-ref
태그 순서가 맞아야 에러가 발생하지 않습니다
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
13 | 웹로직에서 생성한 웹어플리케이션을 윈도우 서비스에 등록하여 자동 실행하기 | 황제낙엽 | 2007.03.30 | 193 |
12 |
현재 서버 셋팅 (Win APM : Windows + Apache + PHP + MySQL)
![]() | 황제낙엽 | 2006.03.21 | 237 |
11 | Tomcat 의 server.xml 에 정의되는 어플리케이션의 예제 | 황제낙엽 | 2007.03.12 | 193 |
10 | What is Geronimo? | 황제낙엽 | 2007.03.03 | 150 |
» | web.xml 태그 작성 순서 | 황제낙엽 | 2006.02.24 | 357 |
8 | 웹어플리케이션 셋팅 (web.xml 엘레멘트 설명) | 황제낙엽 | 2007.02.22 | 332 |
7 |
Tomcat 인스톨가이드 (일본어판)
![]() | 황제낙엽 | 2007.02.20 | 131 |
6 |
WebLogic 인스톨가이드 (일본어판)
![]() | 황제낙엽 | 2007.02.20 | 143 |
5 | httpd.conf 파일 완벽 가이드(1.3X) | 황제낙엽 | 2006.12.27 | 177 |
4 | HTML input form charset tip (WebLogic Server) | 황제낙엽 | 2005.12.01 | 139 |
3 | 톰캣 관련 FAQ | 황제낙엽 | 2005.10.12 | 199 |
2 | 아파치2.0에서 한글 관련 문제점 | 황제낙엽 | 2005.04.25 | 152 |
1 | Evermind Orion Application Server 설치방법 | 황제낙엽 | 2004.02.11 | 152 |