Sprin mvc 出现 No mapping found for HTTP request with URI,解决方案之一

来源:互联网 发布:java安装失败 卸载 编辑:程序博客网 时间:2024/05/22 17:04
一个jsp页面无发注入controller跳转另一个jsp,一直报错,检查各种xml配置没问题。


最后解决是通过 在jsp页面 添加代码
<%
  String path = request.getContextPath();
 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
 %>


在请求路径前加 上<%=basePath%>得到绝对路径,即可跳转


<a href="<%=basePath%>list"   target="frame" class="list-group-item">


说明开法时写绝对路径的重要性
0 0