application.xml与工程配置:

spring mvc路径拦截

 

index.jsp在webapp下,可以直接请求。

配置还有:<mvc:annotation-driven></mvc:annotation-driven>

 

web.xml配置DispatcherServlet拦截/*时,index.jsp请求被拦截

配置mvc:resource,此时路径是/WEB-INF/Page/index.jsp,显示404

 

去掉mvc:resource配置,DispatcherServlet拦截/*,JSP被通配符的Spring拦截

这时路径:localhost:8080/index.jsp,真实路径:/index.jsp 路径没有被映射,可对index.jsp请求

经过Spring拦截,但请求资源存在,显示效果,做静态资源下发了:

spring mvc路径拦截

 

web.xml配置DispatcherServlet拦截/,jsp没被Spring拦截,发起访问,进入index.jsp,页面正常显示。

相关文章:

  • 2021-04-19
  • 2021-11-12
  • 2021-07-25
猜你喜欢
  • 2022-12-23
  • 2021-10-13
  • 2021-08-12
  • 2021-05-25
  • 2021-04-29
  • 2021-10-13
相关资源
相似解决方案