辅导:JAVA基础(basepath变量)
来源:优易学  2011-10-10 13:06:15   【优易学:中国教育考试门户网】   资料下载   IT书店
  <%
  String path = request.getContextPath();
  String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  %>
  <head>
  <base href="<%=basePath%>">
  </head>
  简单的静态网页的话你设置比如:<base href="http://www.baidu.com">,那你下面的href属性就会以你上面设的为基准,如:<a href="http://www.exdada.com/xxx.htm"></a>你现在就只需要写<a href="xxx.htm"></a>

责任编辑:小草

文章搜索:
 相关文章
热点资讯
资讯快报
热门课程培训