title: JSP get domain name
body: <p>for example,my own website is xxx.com. I want to get this domain in jsp or jstl.
  ${pageContext.request.contextPath} just returns "/". 
  I tried this:</p>
  
  <pre><code>&lt;%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %&gt;
  &lt;c:set var="req" value="${pageContext.request}" /&gt;
  &lt;c:set var="url"&gt;${req.requestURL}&lt;/c:set&gt;
  &lt;c:set var="uri" value="${req.requestURI}" /&gt;
  ${fn:substring(url, 0, fn:length(url) - fn:length(uri))}
  </code></pre>
  
  <p>but it returns 127.0.0.1,not domain like xxx.com</p>