在页面获得服务器地址信息

1.
    String baseServerUrl = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();


2.
<%@ 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">  

你可能感兴趣的:(在页面获得服务器地址信息)