打印本文 打印本文  关闭窗口 关闭窗口  
JAVA基础(basepath变量)
作者:佚名  文章来源:不详  点击数  更新时间:2008/10/22 21:35:39  文章录入:杜斌  责任编辑:杜斌

  <%
  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>http://ks.examda.com 考试大论坛
打印本文 打印本文  关闭窗口 关闭窗口