SHOW:
|
|
- or go back to the newest paste.
| 1 | /************************ web.xml ****************************/ | |
| 2 | <?xml version="1.0" encoding="UTF-8"?> | |
| 3 | <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" | |
| 4 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 5 | xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> | |
| 6 | ||
| 7 | <!-- The definition of the Root Spring Container shared by all Servlets and Filters --> | |
| 8 | <context-param> | |
| 9 | <param-name>contextConfigLocation</param-name> | |
| 10 | <param-value>/WEB-INF/spring/root-context.xml</param-value> | |
| 11 | </context-param> | |
| 12 | ||
| 13 | <!-- Creates the Spring Container shared by all Servlets and Filters --> | |
| 14 | <listener> | |
| 15 | <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> | |
| 16 | </listener> | |
| 17 | ||
| 18 | <!-- Processes application requests --> | |
| 19 | <servlet> | |
| 20 | <servlet-name>appServlet</servlet-name> | |
| 21 | <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> | |
| 22 | <init-param> | |
| 23 | <param-name>contextConfigLocation</param-name> | |
| 24 | <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value> | |
| 25 | </init-param> | |
| 26 | <load-on-startup>1</load-on-startup> | |
| 27 | </servlet> | |
| 28 | ||
| 29 | <servlet-mapping> | |
| 30 | <servlet-name>appServlet</servlet-name> | |
| 31 | <url-pattern>/</url-pattern> | |
| 32 | </servlet-mapping> | |
| 33 | - | </web-app> |
| 33 | + | |
| 34 | </web-app> | |
| 35 | ||
| 36 | ||
| 37 | ||
| 38 | /************************ servlet-context.xml ****************************/ | |
| 39 | <?xml version="1.0" encoding="UTF-8"?> | |
| 40 | <beans:beans xmlns="http://www.springframework.org/schema/mvc" | |
| 41 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 42 | xmlns:beans="http://www.springframework.org/schema/beans" | |
| 43 | xmlns:context="http://www.springframework.org/schema/context" | |
| 44 | xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd | |
| 45 | http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd | |
| 46 | http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> | |
| 47 | ||
| 48 | <!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure --> | |
| 49 | ||
| 50 | <!-- Enables the Spring MVC @Controller programming model --> | |
| 51 | <annotation-driven /> | |
| 52 | ||
| 53 | <!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
| |
| 54 | <resources mapping="/resources/**" location="/resources/" /> | |
| 55 | ||
| 56 | <!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory --> | |
| 57 | <beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> | |
| 58 | <beans:property name="prefix" value="/WEB-INF/views/" /> | |
| 59 | <beans:property name="suffix" value=".jsp" /> | |
| 60 | </beans:bean> | |
| 61 | ||
| 62 | <context:component-scan base-package="com.starter.web" /> | |
| 63 | ||
| 64 | ||
| 65 | ||
| 66 | </beans:beans> |