方式一:
1、重写JstlView.checkResource(Locale locale)
方法
package top.hsocode.util;
import org.springframework.web.servlet.view.JstlView;
import java.io.File;
import java.util.Locale;
public class DefaultJstlView extends JstlView {
@Override
public boolean checkResource(Locale locale) throws Exception {
File file = new File(this.getServletContext().getRealPath("/") + getUrl());
return file.exists();
}
}
2、dispatcher-servlet.xml配置
<!--view multi-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="top.hsocode.util.DefaultJstlView"/>
<property name="prefix" value="/WEB-INF/view/"/>