web.xml

5670 단어 maven강의록XMLXML

java : 자바소스 폴더
resources : 프로그램 실행에 필요한, 소스가 아닌 파일 폴더
webapp : index.jsp > 웹 어플리케이션 만드는 요소기술 중 하나.
동적으로 응답 처리해서 동적으로 데이터를 만들어내서 데이터를 출력할 웹 어플리케이션들이 모여있는 폴더.
maven에서는 이 폴더의 이름이 webapp 으로 정해져있다.

DocumnetRoot 폴더의 구조

DocumentRoot	//maven 에서는 src/main/webapp/
	/ WEB-INF
    		/web.xml (배치설명자)
            /classes / *.class ->컴파일된 클래스폴더
            /lib/*.jar -> 외부 라이브러리 폴더
            

배치설명자(web.xml) -> Deployment Descriptor
배치 : 웹 어플리케이션 프로그램을 was환경에 올려놓은 것.
배치설명자 : 배치를 어떻게 할건지? 서블릿 컨테이너에게 알려주는 역할.
1. @WebServlet() 어노테이션 사용해서 알려주기
2. web.xml에 태그로 등록해서 알려주기.

<?xml version="1.0" encoding="UTF-8"?>


<!-- for tomcat 8.x -->		<!--톰캣버전 8.x일때는 웹앱(서블릿) 버전 3.1-->
<!-- <web-app
  xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
  version="3.1"> -->

<!-- for tomcat 9.x -->		<!--톰캣버전 9.x일때는 웹앱(서블릿) 버전 4.0-->
<web-app
  xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
  version="4.0">

  <display-name>ex00</display-name>	<!--웹 프로젝트 자체의 이름이 아니다. Deployment Descriptor-DD- 에 표시될 이름-->
  
  
  <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>

welcome-file-list : 기본 파일.
사용자가 포트번호만 입력하든, 슬래시 해서 접속했을 때 기본으로 찾는 파일 목록.
이 목록들 중 있는것으로 응답 보내기

좋은 웹페이지 즐겨찾기