BacGyber's Tricks

[Spring] How to exclude html in Spring MVC

□ Tech (Software)

[Spring] How to exclude html in Spring MVC

[스프링] Spring MVC 에서 html 예외처리


IntelliJ 써볼까 해서... 집에서 다운로드 받아서 스프링으로 간단 프로젝트 만들다가 메모를 남겨본다.


프레임웍 처음부터 새로 구성할때마다 이걸 찾아서 했던거 같다.


뭐... 기존 소스가 있으면 찾아봐도 될텐데 집이라서....


Spring MVC xml 에 한 줄 넣어주면 된다.



<?xml version="1.0" encoding="UTF-8"?>

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

             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

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

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

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

             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-3.0.xsd

http://www.springframework.org/schema/mvc

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


    <context:component-scan base-package="com.bacgyber.helloworld"/>


    <mvc:default-servlet-handler/>


    <beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">

        <beans:property name="prefix" value="/WEB-INF/views/" />

        <beans:property name="suffix" value=".jsp" />

    </beans:bean>


</beans:beans>


ref) http://docs.spring.io/spring/docs/3.1.x/spring-framework-reference/html/mvc.html#mvc-default-servlet-handler


딱 0.5초~ 아래 공감버튼 누르는데 사용해주시면

제 기분은 5배 Up 이 될거 같아요 :)