日期:2014-05-17  浏览次数:20759 次

ie10下jquery ajax data参数在服务器端无法获取参数值跪求帮助
js代码
function addRole()
        {
         var roleName='哈哈哈';
         var roleDescr='哈哈哈';
         var msg="";
         if(null==roleName || ""==roleName){
         msg+="角色名称不能为空<br>";
         }
         if(null==roleDescr || ""==roleDescr){
         msg+="角色描述不能为空<br>";
         }
         if(null!=msg && ""!=msg){
         $.ligerDialog.alert(msg, '提示', 'warn');
         return false;
         }
         $.ajax({
              type:"POST",
              url:"<%=basePath%>company/saveRoleInfo.do?roleName="+encodeURI(encodeURI(roleName))+"&roleDescr="+roleDescr,
              data:{name:1},
              dataType:'text',
              contentType:"application/x-www-form-urlencoded:charset=UTF-8",
              success:function(data){
               if("true"==data){
               parent.f_closeTab('company_role_add');
               }else{
               $.ligerDialog.alert("角色添加失败,请稍后再试!", '提示', 'error');
               }
              }
           });
        }
后台代码:
@RequestMapping("company/saveRoleInfo.do")
public String saveRoleInfo(String roleName,String roleDescr,HttpServletRequest request,HttpServletResponse response){
try {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
System.out.println( URLDecoder.decode(roleName,"UTF-8")+"\n"+roleDescr+"\n"+request.getParameter("name"));
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
//boolean flag=this.companyRoleService.saveRoleInfo(roleName, roleDescr);
try {
response.getWriter().write(Boolean.toString(true));
} catch ( 关于后台取值有关问题