![](/img/trans.png)
[英]Spring newbie: The url-pattern for my DispatcherServlet seems to 'override' the welcome-file
[英]Why is every url “redirecting” to the welcome-file url?
小程序
@WebServlet("/")
public class AServlet extends HttpServlet {
-加载.jsp
并显示“ AServlet”
@WebServlet("/b")
public class BServlet extends HttpServlet {
-返回一个简单的JSON
index.html
-显示“不是JSP”
web.xml
...
<welcome-file-list>
<welcome-file>/</welcome-file>
</welcome-file-list>
...
每个与servlet不匹配的url都执行与A servlet相同的操作。
例如:
将Servlet映射到“ /”使其成为默认Servlet,这意味着它将处理所有与任何其他映射都不匹配的请求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.