<div class="form-group">
<label class="col-sm-2 control-label no-padding-right"><%--批准禁用离职AD账号--%><fmt:message key="global_approve_resigned_ad_account"/>
<b class="red">*</b></label>
<div class="col-sm-10">
<label class="checkbox">
//checked="checked"表示选中
<input type="checkbox" class="allSys" name="check" value="1" checked="checked">
<%--禁用离职人员AD账号--%><fmt:message key="global_disable_resigned_employee_ad_account"/>
</label>
<label class="checkbox">
<input type="checkbox" class="allSys" name="check" value="2">
<%--禁用的AD账号转移到disable的OU中--%><fmt:message key="transferr_disabled_ad_account_to_disabled_ou"/>
</label>
<lable class="checkbox">
<input type="checkbox" class="allSys" name="check" value="3" >
<%--禁用的AD账号清除其所隶属的所有组--%><fmt:message key="global_ad_all_groups_clear"/>
</lable>
<label class="checkbox">
<input type="checkbox" class="allSys" name="check" value="4">
<%--禁用的AD账号清除其“属性-组织”的经理字段--%><fmt:message key="global_ad_attribute_organization_clear"/>
</label>
<label class="checkbox">
<input type="checkbox" class="allSys" name="check" value="5" checked="checked">
<%--禁用的AD账号关闭exchange邮箱账号--%><fmt:message key="global_ad_exchange_function_close"/>
</label>
</div>
</div>
这是复选框 现在要将选中的复选框的值(默认1234)传入后端 通过tijiao()来实现
function tijiao(){
var checkID="";
$("input[name='check']:checked").each(function(i){
checkID += $(this).val();
}); //遍历了选中的复选框 把值存入checkID数组
alert('${item.adCode}')
alert(checkID)
$.ajax({
data:
{'checkId':checkID,
'adCode':'${item.adCode}' //注意要加引号 这是员工的AD之前传入前端的
},
success: function(){
},
type:'post',
url:'${basePath}/disableAd/test', //跳转到后端的url地址
}
);
}
后端接口
@RequestMapping("test")
@ResponseBody //后端内容都放在response 前端都保存在request
//这里接受data的参数 只要参数名一致即可
public String[] doPost(HttpServletRequest request,String adCode,String checkId){
System.out.print(adCode);
System.out.print(checkId);
return null;