在页面获得服务器地址信息
1.
1 2 |
Java代码 String baseServerUrl = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath(); |
2.
1 2 3 4 |
Html代码 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <c:set var="ctx" value="${pageContext.request.contextPath}"/> <link type="image/x-icon" rel="shortcut icon" href="${ctx}/static/images/favicon.ico"> |