1. 정의

디렉토리의 기본 웹 페이지

디렉토리를 방문 했을 때 그 디렉토리에 맞는 기본 화면을 제공하기 때문에 웰컴 파일이라 함

url을 파일명이 아닌 디렉토리명으로 받았을 경우, 기본적으로 불러올 파일명을 지정해야 함



2. 특징

여러 개의 welcome 파일을 등록시 디렉토리에서 웰컴 파일을 찾을 때 태그에 선언된 위 > 아래 순서대로 조회하여 먼저 찾은 순대로 클라이언트로 보냄

둘 다 없을 시, 디렉토리 내의 모든 파일을 보여주거나 404 에러를 내보내기도 함



3. 예시

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
  
  <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>
 
</web-app>
cs



* 이러한 welcome-file-list 태그는 Tomcat 내의 기본 web.xml인 %CATALINA_HOME%/conf/web.xml 에도 존재하고, 프로젝트의 web.xml 두 곳에 모두 존재하나 프로젝트 내의 web.xml의 순위가 더 높음

+ Recent posts