项目名 的在JSP或JAVA中的另类写法

在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>");


 

posted @ 2016-12-15 20:14  奋斗的少年WH  阅读(232)  评论(0编辑  收藏  举报