suffix prefix
springboot 에서 jsp 사용할 때 혹은 그냥 servlet jsp 를 사용할 때 controller 혹은 servlet 에서 view 로 넘겨줄 때 어떤 경로로 어떤 확장자로 찾아야할 지 미리 지정해줄 수 있습니다.
각각 무슨 뜻인가Permalink
prefix 는 접두사 (단어 앞에 들어가는 것)
suffix 는 접미사 (단어 뒤에 들어가는 것)
xml 로 설정Permalink
mvc-config 에서 설정해주면 됩니다!
<?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:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<mvc:annotation-driven></mvc:annotation-driven>
<context:component-scan base-package="hachi.education_management"></context:component-scan>
<mvc:resources mapping="/static/**" location="/static/"/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/view"/>
<property name="order" value="1"/>
<property name="suffix" value=".jsp"/>
</bean>
</beans>
application.yml 에서 설정하기Permalink
spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp