标签:name app list com att nbsp 后缀 lis servlet
方法一、配置welcome-file-list和servlet-mapping
<!-- 将默认欢迎页配置为要访问的controller路径 -->
<welcome-file-list>
<welcome-file>task/code.do</welcome-file>
</welcome-file-list>
<!-- 配置拦截的后缀 -->
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
方法二、同样是配置welcome-file-list和servlet-mapping
<!-- 不用.do后缀 -->
<welcome-file-list>
<welcome-file>task/code</welcome-file>
</welcome-file-list>
<!-- 另外配置一个servlet-mapping拦截欢迎页配置的路径 -->
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>/task/code</url-pattern>
</servlet-mapping>
标签:name app list com att nbsp 后缀 lis servlet
原文地址:https://www.cnblogs.com/fengzifengfeng/p/10203238.html