关于js取servlet中request.Attribute值的方法

Servlet中的代码:

request.setAttribute("methodId", method);
request.setAttribute("infos",infos);
request.setAttribute("currentPage", String.valueOf(currentPage));
request.setAttribute("count", count);
request.setAttribute("pageCount",pageCount);
request.getRequestDispatcher("Index.jsp").forward(request,response);

其中method的值为String类型:

String method = request.getParameter("method");

js代码为:

window.onload = function changColor(){
    var systemId = getQueryString("methodId");
    if(systemId == null){
        var currentA = document.getElementById("ITSM");
        currentA.style.color = "#FFCC00";
    }
    else {
        var currentA = document.getElementById(systemId);
        currentA.style.color = "#FFCC00";
    }
}
 function getQueryString(name){
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]); return null; 
}

实现的功能是将对应的文字颜色初始化。
这种方式我在之前的项目中用过,现在无法从Servlet中取值了,各位大神,帮忙分析下

 参数没有直接拼接在url后面,应该用el表达是来取var s = '${methodId}';

js没有方法得到request的值。你可以通过<% %>混写的方式得到。或者用el表达式把值给一个input 隐藏控件,然后用js去到那个空间的值