本文概要:主要简单介绍jsp中获取路径的各种方法.
比如request.getRequestURI request,getRequestURL request.getContextPath request.getRealpath等等
尝试把下面的代码放到不同的站点、不同路径下运行 查看效果
request.getRealPath(""):<br />
... 本文概要:主要简单介绍jsp中获取路径的各种方法.
比如request.getRequestURI request,getRequestURL request.getContextPath request.getRealpath等等
尝试把下面的代码放到不同的站点、不同路径下运行 查看效果
request.getRealPath(""):<br />
<%=request.getRealPath("")%><p/>
request.getRealPath("/"):<br />
<%=request.getRealPath("/")%><p/>
request.getScheme():<br/><%=request.getScheme() %><p/>
request.getServerName():<br/><%=request.getServerName() %><p/>
request.getServerPort():<br/><%=request.getServerPort() %><p/>
request.getMethod():<br/><%=request.getMethod() %><p/>
request.getRequestedSessionId():<br/><%=request.getRequestedSessionId() %><p/>
request.getRequestURI():<br/><%=request.getRequestURI() %><p/>
request.getRequestURL():<br/><%=request.getRequestURL() %><p/>
request.getQueryString():<br/><%=request.getQueryString() %><p/>
request.getServletPath():<br/><%=request.getServletPath() %><p/>
request.getProtocol():<br/><%=request.getProtocol() %><p/>
request.getContextPath():<br/><%=request.getContextPath() %><p/>
request.getSession().getServletContext().getRealPath(request.getRequestURI()):<br/><%=request.getSession().getServletContext().getRealPath(request.getRequestURI()) %><p/>