1
我想在動作類,我設置訪問複選框值在JavaScript複選框值Struts 2的
<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();
}
當我嘗試訪問它在行動類像下面我得到空
public MDesig mstDesignations=new MDesig();
System.out.println("Is Active value:::" +mstDesignations.getIsActive());