본문 바로가기

Spring

web.xml

반응형

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

<web-app version="3.0" 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">

 

       <welcome-file-list>

             <welcome-file>index.html</welcome-file>

       </welcome-file-list>

 

       <listener>

             <listener-class>

org.springframework.web.context.ContextLoaderListener

 </listener-class>

             <!-- ContextLoaderListener 호출 -->

       </listener>

 

       <context-param>

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

             <param-value>/WEB-INF/applicationContext.xml</param-value>

             <!-- 컨트롤러가 사용할 객체를 관리하는 xml파일이 무엇인지 설정함 -->

       </context-param>

 

       <servlet>

             <servlet-name>mvc</servlet-name>

             <servlet-class>

org.springframework.web.servlet.DispatcherServlet

 </servlet-class>

             <load-on-startup>1</load-on-startup><!-- 서블릿 호출 우선순위 -->

       </servlet>

 

       <servlet-mapping>

             <servlet-name>mvc</servlet-name>

             <url-pattern>*.sp</url-pattern>

       </servlet-mapping>

      

       <!-- 위와 같이 설정을 추가하는 경우 스프링 MVC 설정파일의 이름은

"mvc-servlet.xml"된다.

       (스프링 MVC 설정파일의 이름은 따로 설정하지 않으면 디폴트로 DispatcherServlet클래스의

       servlet-name + "-servlet.xml" 된다. ) -->

 

 

 

</web-app>

 

 

web.xml

 

반응형