Html struts复选框:取消选择并提交

Html struts复选框:取消选择并提交,html,struts,Html,Struts,在我的JSP页面中,我有: <nested:checkbox property="product.hasEmployee" /> 当我取消选择该复选框时,默认选中该复选框 我提交页面,我发现它被选中了 如何解决此问题?在服务器端执行此代码: if (request.getParameter("product.hasEmployee") == null) { product.setHasEmployee(false); } 如何使其“默认选中”?这是在您的表单对象中还

在我的JSP页面中,我有:

<nested:checkbox property="product.hasEmployee" />

当我取消选择该复选框时,默认选中该复选框 我提交页面,我发现它被选中了


如何解决此问题?

在服务器端执行此代码:

if (request.getParameter("product.hasEmployee") == null) {
     product.setHasEmployee(false);
}
如何使其“默认选中”?这是在您的
表单
对象中还是在
控制器
中?有更多关于这方面的代码会很有帮助。