Spring 2.5 servlet mapping - 다른예

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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_2_5.xsd">

 <!-- Enables clean URLs with JSP views e.g. /welcome instead of /app/welcome -->
 <filter>
  <filter-name>UrlRewriteFilter</filter-name>
  <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
 </filter>

 <filter-mapping>
  <filter-name>UrlRewriteFilter</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>
  
 <!-- Handles all requests into the application -->
 <servlet>
  <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
  <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  <init-param>
   <param-name>contextConfigLocation</param-name>
   <param-value>
    /WEB-INF/spring/*.xml
   </param-value>
  </init-param>
  <load-on-startup>1</load-on-startup>
 </servlet>
  
 <!-- Maps all /app requests to the DispatcherServlet for handling -->
 <servlet-mapping>
  <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
  <url-pattern>/app/*</url-pattern>
 </servlet-mapping>
 
</web-app>
-----------------------------------------------------------------------------
mvc-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:context="http://www.springframework.org/schema/context"
 xsi:schemaLocation="
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
  http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">

 <!-- HANDLER MAPPING RULES -->
 
 <!-- Maps requests to @Controllers based on @RequestMapping("path") annotation values
   If no annotation-based path mapping is found, Spring MVC proceeds to the next HandlerMapping (order=2 below). -->
 <!-- 실제로 이 예제에선 사용되지 않는다. -->
 <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
  <property name="order" value="1" />
 </bean>
 
 <!-- Maps requests to @Controllers based on controller class name convention; e.g. a request for /hotels or a /hotels sub-resource maps to HotelsController
      If no class mapping is found, Spring MVC sends a 404 response and logs a pageNotFound warning. -->
    <!-- 예제는 이것을 사용 -->     
 <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping">
  <property name="order" value="2" />
 </bean>

 <!-- REGISTERED HANDLER TYPES -->

 <!-- Enables annotated @Controllers; responsible for invoking an annotated POJO @Controller when one is mapped. -->
 <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />

 <!--  VIEW RESOLUTION AND RENDERING -->
 
 <!-- Resolves view names to protected .jsp resources within the /WEB-INF directory -->
 <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  <property name="prefix" value="/WEB-INF/pages/"/>
  <property name="suffix" value=".jsp"/>
 </bean>
 
</beans>
-----------------------------------------------------------------------------
app-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:context="http://www.springframework.org/schema/context"
 xsi:schemaLocation="
  http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
  http://www.springframework.org/schema/context
  http://www.springframework.org/schema/context/spring-context-2.5.xsd">
 
 <!-- Scans within the base package of the application for @Components to configure as beans -->
 <!-- base-pacakage 의 하위 패키지에서 어노테이션을 사용한 클래스를 자동으로 등록한다
      따라서 <bean id=".." class=".."/>를 설정할 필요가 없다.
  -->
 <context:component-scan base-package="com.zoo.bookstore"/>
 
</beans>

by CHillo | 2009/10/28 15:40 | 트랙백 | 덧글(0)
트랙백 주소 : http://zoonoo.egloos.com/tb/5154283
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]

:         :

:

비공개 덧글

< 이전페이지 다음페이지 >