简单基础路径配置(单用JSP)EASYUI

 

 

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page isELIgnored="false"%>
<%  
       String path=request.getContextPath();  
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  
  //  System.out.println(basePath);
    
    %>
<head>
<meta charset="UTF-8">
 
   
    <base href="<%=basePath%>"></base> 
<%-- <c:set var="ctxt" value="${pagecontext.request.contextpath}"></c:set> --%>

<link id="easyuiTheme" rel="stylesheet" type="text/css"
    href="<%=basePath%>/frame/comp/easyui/themes/default/easyui.css" />


<script type="text/javascript"
    src="<%=basePath%>/frame/comp/easyui/jquery.min.js"></script>


<script type="text/javascript"
    src="<%=basePath%>/frame/comp/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript">
    if (!localStorage.getItem("accessToken")) {//处理跨域的问题
        if (getQueryString('accessToken')) {
            localStorage.accessToken = getQueryString('accessToken');
        }
    }
    $.ajaxSetup({
        data : {
            "accessToken" : localStorage.getItem("accessToken") == null ? ""
                    : localStorage.getItem("accessToken")
        }
    });

    function getQueryString(name) {//获取请求参数
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null)
            return unescape(r[2]);
        return null;
    }
</script>

 

posted on 2017-08-30 11:48  决心觉新  阅读(230)  评论(0编辑  收藏  举报