在JSP页面中
${pageContext.request.contextPath } 表示项目名
<form action="${pageContext.request.contextPath }/sarchServlet" method="post" name="form1">
在Java中
String rot = request.getContextPath(); 表示项目名
out.print("<a href='"+rot+"/myFriendShow.do'>返回</a>");
在JSP页面中
${pageContext.request.contextPath } 表示项目名
<form action="${pageContext.request.contextPath }/sarchServlet" method="post" name="form1">
在Java中
String rot = request.getContextPath(); 表示项目名
out.print("<a href='"+rot+"/myFriendShow.do'>返回</a>");
转载于:https://www.cnblogs.com/1020182600HENG/p/6184634.html