先说一下,我是通过ajax在也没加载时发送请求,将需要添加的信息(acl)得到,现在问题是页面得到了之后怎么进一步把改选中的checkbox选中,选中的关键数据正确返回了,但是该怎么一个个对应上.也就是说我我要把已经分配的权限自动添加上去
strut的代码:
public  ActionForward searchAclRecords(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)
throws Exception {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charet=UTF-8");
response.setHeader("Cache-Control", "no-cache");

PrintWriter out = response.getWriter();
out.println("<response><res>");

System.err.println("authorizationtypeId:" + request.getParameter("authorizationtypeId"));
ArrayList<?> lists = (ArrayList<?>) aclManager.searchAclRecords(request.getParameter("authorizationtype"),
Integer.parseInt(request.getParameter("authorizationtypeId")));
out.print(lists);
System.out.println("lists:" + lists);
out.print("</res></response>");
return null;
}
页面代码:
window.onload = function(){
    //alert(document.getElementById("authorizationtypeId").value);
    //alert(document.getElementById("authorizationtype").value);
    //alert($('#authorizationtypeId').val());
    //alert($('#authorizationtypeId'));
    authorizationtypeId = $('#authorizationtypeId').val();
    authorizationtype = $('#authorizationtype').val();
    //alert(authorizationtypeId);
    //alert(authorizationtype);
    var url;
    url = "acl.do?method=searchAclRecords&authorizationtypeId=" + authorizationtypeId + "&authorizationtype=" + authorizationtype;
            // 加随机数防止缓存
  if (url.indexOf("?") > 0)
  {
   url += "&randnum=" + Math.random();
  }
  else
  {
   url += "?randnum=" + Math.random();
  }
    createXMLHttpRequest();
    XMLHttpReq.open("get",url,true);
    XMLHttpReq.onreadystatechange = processResponse;//指定回调函数
    XMLHttpReq.send(null);//发送请求
   };页面显示效果(很难看,自己写的好玩,因为在学校没有美工)