前端获取http和完整项目名

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

 

添加在header上或者其他需要用的地方

 

使用方法   <%=basePath%>  后面 不用加斜杠

posted @ 2018-06-16 10:34  喝耶加雪啡的JAVA猴子  阅读(414)  评论(0编辑  收藏  举报