2012/04/19 18:22

web.xml & DispatcherServlet 필수요소. Architect



web.xml
스프링 설정 파일 위치
<context-param> 
<param-name>contextConfigLocation</param-name> 
<param-value>classpath*:/spring/context-*.xml</param-value> 
</context-param>
스프링 리스너
<listener> 
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
</listener>
서블릿 선언
서블릿 매핑
<servlet> 
<servlet-name>pms</servlet-name> 
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
<init-param> <param-name>contextConfigLocation</param-name> 
<param-value>classpath:/config/dispatcher-servlet.xml</param-value> 
</init-param> 
<load-on-startup>1</load-on-startup> 
</servlet> 
<servlet-mapping> 
<servlet-name>pms</servlet-name> 
<url-pattern>*.action</url-pattern> 
</servlet-mapping>


dispatcherServlet
<context:annotation-config /> - 어노테이션 사용 선언
<context:component-scan base-package="....." /> (여러 프로젝트인 경우 , 구분)
anotation Handler 선언 
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
resolver 선언
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> 
<property name="prefix" value="/WEB-INF/jsp/" /> 
<property name="suffix" value=".jsp" /> <property name="order" value="1" /> 
 </bean>

덧글

댓글 입력 영역