我想访问我在 javascript 中设置的操作类中的复选框值
<s:checkbox key="mstDesignations.isActive" id="isActive"></s:checkbox>
<button type="button" class="submitBtn" onclick="adddesignation()"></button>
javascript:
function adddesignation() {
if(document.designationForm.isActive.checked==true){
document.designationForm.isActive.fieldValue=1;
}
else if( document.designationForm.isActive.checked==false)
{
document.designationForm.isActive.fieldValue=2;
}
alert(document.designationForm.isActive.fieldValue);
document.designationForm.submit();
}
当我尝试在下面的操作类中访问它时,我得到 null
public MDesig mstDesignations=new MDesig();
System.out.println("Is Active value:::" +mstDesignations.getIsActive());