본문 바로가기
프로그래밍/spring

springMVC config

by 카라미 2015. 10. 28.


org.springframework.web-3.0.5.RELEASE.jar


org.springframework.web.servlet-3.0.5.RELEASE.jar



web.xml




<servlet>

<servlet-name>sprinExam</servlet-name>

<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

<init-param>

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

<param-value>/WEB-INF/sprinExam-servlet.xml </param-value>

</init-param>

</servlet>

<servlet-mapping>

<servlet-name>sprinExam</servlet-name>

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

</servlet-mapping> 

  <filter>

<filter-name>encodingFilter</filter-name>

<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>

<init-param>

<param-name>encoding</param-name>

<param-value>UTF-8</param-value>

</init-param>

<init-param>

<param-name>forceEncoding</param-name>

<param-value>true</param-value>

</init-param>

</filter>

<filter-mapping>

<filter-name>encodingFilter</filter-name>

<url-pattern>/*</url-pattern>

</filter-mapping>



sprinExam-servlet.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"

xmlns:mvc="http://www.springframework.org/schema/mvc" 

xmlns:p="http://www.springframework.org/schema/p" 

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd

http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">


<!-- 스프링의 DispatcherServet에게 정적인 자원을 알려준다. -->

<mvc:resources location="/images/" mapping="/images/**" />

<mvc:resources location="/css/" mapping="/css/**" />

<mvc:resources location="/js/" mapping="/js/**" />

<mvc:resources location="/templates/" mapping="/templates/**" />


<context:component-scan base-package="kr.co.sunnyvale.board">

<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />

</context:component-scan> 

<!--  spring 3.x -->

<mvc:annotation-driven/>


<!-- ViewResolver -->

<bean id="internalResourceViewResolver"

class="org.springframework.web.servlet.view.InternalResourceViewResolver">

<property name="viewClass">

<value>org.springframework.web.servlet.view.JstlView</value>

</property>

<property name="prefix">

<value>/WEB-INF/views/</value>

</property>

<property name="suffix">

<value>.jsp</value>

</property>

</bean>


<bean id="multipartResolver"

class="org.springframework.web.multipart.commons.CommonsMultipartResolver"

p:maxUploadSize="104857600" p:maxInMemorySize="10485760" />


</beans> 



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

spring_mabatis 설정  (0) 2015.11.02
filter  (0) 2015.10.29
springMVC config  (0) 2015.10.28
sping ioc annotaion 기반 설정 예제  (0) 2015.10.27
spring ApplicationContext bean 초기화  (0) 2015.10.26