1. 程式人生 > >前端獲取http和完整項目名

前端獲取http和完整項目名

tex etc TE sch 需要 h+ ext contex 斜杠

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

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

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

前端獲取http和完整項目名