jsp的路径

1)<%= request.getContextPath() %>   

获得站点根路径,可以解决相对路径的问题。

 

比如: <a href="<%= request.getContextPath() %>/catalog.jsp"> 链接到根路径下的catalog.jsp

 

 

2)<%= request.getServerName() %>

获取浏览器中显示的主机名

 

3<%= getServerPort() %>

服务器端口号

 

4<%= request.getScheme() %>
返回协议名称,默认是http

 

5<%= request.getRealPath("/") %>

得到项目文件的实际物理路径
 

你可能感兴趣的:(jsp,浏览器)