• jsp中获取页面的相对路径


    1.在jsp页面的上方加上这段java代码

    <%
    //        request.getContextPath() 返回当前页面所在的应用的名字;
    //        request.getSchema() 返回当前页面使用的协议,如:http;
    //        request.getServerName() 返回当前页面所在的服务器的名字;
    //        request.getServerPort() 返回当前页面所在的服务器使用的端口 String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %>

     2.在jsp页面的<head></head>下加上这段代码

    <head>
        <base href="<%=basePath%>">
         <script src="js/jquery-1.9.1.js"></script>
    </head> 
    

    这样就可以了

  • 相关阅读:
    PHP array_intersect_uassoc
    PHP array_intersect_key
    PHP array_intersect_assoc
    PHP array_flip
    PHP array_filter
    PHP array_fill
    PHP array_fill_keys
    Android4.0-Fragment框架实现方式剖析
    Fragment 生命周期
    WebView
  • 原文地址:https://www.cnblogs.com/2016-10-07/p/7345555.html
Copyright © 2020-2023  润新知