웹 & 프레임워크

스프링 기본 web.inf 설정방법

늘근이 2014. 5. 25. 22:47

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

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"id="WebApp_ID" version="2.5">

  <display-name>0502_step01_mvc_api</display-name>

 

  <!-- The front controller of this Spring Web application, responsible for handling all application requests -->

 

  <!-- web 처음부터 처음생성되고 초기화될때 웹에 맞는 spring container 만들어냄

   자바에서는 context어쩌고를 만들어내는데웹에서는 xml설정 이놈으로 해준다 -->

 

                  <servlet>

                                   <servlet-name>dispatcher</servlet-name> <!-- 이건바꿔도됨 -->

                                   <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

                                   <!-- 설정파일 기본값 : WEB-INF / xxx-servlet.xml --> <!-- xxx자리에는 등록된 servlet-name 주면된다 -->

                                   <!-- 보통 컨트롤러나   나눠서 설정제어함그냥  하면 설정동시작업하기  구림 -->

                                   <!-- <init-param>

                                                     <param-name>contextConfigLocation</param-name>

                                                     <param-value>location</param-value>

                                   </init-param> --> <!-- 요건 필수는아님 위에 기본설정 안쓰려면 이걸 설정한다 -->

                                   <load-on-startup>1</load-on-startup> <!-- 이설정 안하면 최초요청시에 만들어짐

                                   이런애가 여럿있는 경우만 의미가 있음. 1인애가 먼저 시작되는거임

                                    1주면 순서상관없다능 -->

                  </servlet>

 

                  <!-- Map all requests to the DispatcherServlet for handling -->

                  <servlet-mapping>

                                   <servlet-name>dispatcher</servlet-name><!-- 서블릿이름은 맞춰준다 -->

                                   <url-pattern>*.do</url-pattern><!-- *.do 오는 요청은  일로 -->

                  </servlet-mapping>

 

  <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>