标签:
JSP页面默认不支持.html后缀
一、因为Tomcat容器问题
HTML页面默认使用org.apache.catalina.servlets.DefaultServlet
JSP页面默认使用org.apache.jasper.servlet.JspServlet
<!-- The mapping for the default servlet -->
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- The mappings for the JSP servlet -->
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.jspx</url-pattern>
</servlet-mapping>
二、修改项目web.xml
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
三、使用SpringMVC的话,配置
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/views/" p:suffix=".html" p:order="3" />
标签:
原文地址:http://www.cnblogs.com/w279526837/p/5719083.html