`
to_zoe_yang
  • 浏览: 138945 次
  • 性别: Icon_minigender_2
  • 来自: 01
社区版块
存档分类
最新评论

路径问题

 
阅读更多

看马士兵老师的Struts2总结,觉得这个方法很好。

 

<%
String path = request.getContextPath();
String basePath =  request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

 

 

<head>

<!-- 设置base标签,当前页面的所有超链接前面都会自动加上basePath -->

<base href="<%=basePath%>" />

</head>

 

<body>

<a href="index.jsp">index.jsp</a>

</body>

 

这个basePath可以放在一个基本的jsp,别的jsp可以include进来!

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics