Spring MVC的 表单提交相对路径异常问题

表单提交后,action的URL写的是, saler/release,每次跳转后都变成saler/saler/release,很显然是相对路径没有搞清楚。

应该弄清楚相对路径,并在JSP代码中加入,这样当前页面能够在basePath后面append相对路径,从而找到正确的controller 


<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>



你可能感兴趣的:(Spring MVC的 表单提交相对路径异常问题)