DispatcherServlet 설정

web.xml



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
 
         http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
 
         version="3.1">
 
         
 
         
 
         <!-- Front 컨트롤러 설정 -->
 
         <servlet>
 
             <servlet-name>dispatcher</servlet-name>
 
             <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
 
         </servlet>
 
         
 
         <servlet-mapping>
 
             <servlet-name>dispatcher</servlet-name>
 
             <url-pattern>/</url-pattern>
 
         </servlet-mapping>
 
         
 
</web-app>


dispacher-servlet.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?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"
    xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:security="http://www.springframework.org/schema/security"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">
  
      <mvc:annotation-driven />
      
    <context:component-scan base-package="패키지명" />  
        
 
    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
        <property name="prefix" value="/WEB-INF/views/" />
        <property name="suffix" value=".jsp" />
    </bean>
 
</beans>
    
 


'프로그래밍 > Spring' 카테고리의 다른 글

@RequestParam과 @PathVariable  (0) 2019.01.03
Java Cofig 설정 1편  (0) 2018.12.07
mybatis 빈설정  (0) 2018.07.14
로그인 예제  (0) 2018.07.13
RSA 암호화 예제 2  (0) 2018.07.13
TAGS.

Comments