【原配置】
<dispatch-servlet.xml> DispatcherServlet 对应的配置文件
<bean id="viewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.freemarker.FreeMarkerView" />
<property name="contentType" value="text/html;charset=UTF-8" />
<property name="prefix" value="/WEB-INF/ftl/" />
<property name="suffix" value=".html" />
</bean>
<bean id="freemarkerConfig"
class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
<property name="templateLoaderPath" value="/WEB-INF/view/" />
<property name="freemarkerSettings">
<props>
<prop key="template_update_delay">0</prop>
<prop key="default_encoding">UTF-8</prop>
<prop key="number_format">0.##########</prop>
<prop key="datetime_format">yyyy-MM-dd HH:mm:ss</prop>
<prop key="classic_compatible">true</prop>
<prop key="template_exception_handler">ignore</prop>
</props>
</property>
</bean>
【出现问题】
Could not resolve view with name ‘/XXXX‘ in servlet with name ‘spring‘
【解决方法】
freemarkerConfig 中配置了templateLoaderPath 就不需要viewResolver中的prefix