zoukankan      html  css  js  c++  java
  • MyEclipse中新建JSP(Advanced Template)文件时自动生成的

    1     <meta http-equiv="pragma" content="no-cache">
    2     <meta http-equiv="cache-control" content="no-cache">
    3     <meta http-equiv="expires" content="0">    
    网页中常常看见有这样的标记,他们是清楚浏览器缓存用的,记录下来,方便以后查询,以免忘记。
    清除浏览器中的缓存,它和其它几句合起来用,就可以使你再次进入曾经访问过的页面时,ie浏览器必须从服务端下载最新的内容,达到刷新的效果。
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    

      

    myeclipse中jsp页面<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> 是指

    搜索关键字,就是用搜索引擎搜索的时候会和这个关键字匹配,从而找到你的网站。

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

     

    request.getContextPath()——当前应用的名字,就是工程的名字。
    request.getScheme()——当前页面使用的协议,比如“http”
    request.getServerName()——当前服务器的名字,比如“localhost”
    request.getServerPort()——当前服务器使用的端口
    <base href="<%=basePath%>">
    

    base标签的作用:定位路径用的,表示该页面的请求是根路径下的。

    比如说 你下面有个<img src='1.jpg' /> 因为你上面设置了base标签 所以这个img标签的src的路径就应该为basePath +1.jpg。



  • 相关阅读:
    Maven入门教程
    认识Java Core和Heap Dump
    [Java IO]03_字符流
    Eclipse 实用技巧
    可变和不可变的区分
    什么猴子补丁待补充
    当退出python时,是否释放全部内存
    解释python中的help()和dir()函数
    在python中是如何管理内存的
    解释一下python中的继承
  • 原文地址:https://www.cnblogs.com/4everlove/p/3378874.html
Copyright © 2011-2022 走看看