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。



  • 相关阅读:
    跨站脚本攻击(XSS)
    Web安全
    Http权威指南(cookie以及web认证机制)
    微信小程序页面跳转方法汇总
    php函数
    Http权威指南(服务器、缓存)
    Content-type与json对象/字符串杂谈
    微信小程序之答题领券系统构建
    Fiddler手机抓包,相关细节回顾
    一幅漫画揭示了项目研发过程中存在的问题,太形象了
  • 原文地址:https://www.cnblogs.com/4everlove/p/3378874.html
Copyright © 2011-2022 走看看