checkbox value. getting strange value when checked/unchecked
i have a checkbox in jsf as follow. this jsf page is in the portal page. when i check the checkbox i get value as "on" and when i uncheck it i get the value as null. Why is i开发者_运维知识库t like that. the code is as below:
the checkbox is in formitem. isFullTimeStudent is of type Boolean
> <hx:formItem styleClass="formItem"
> id="fullTimeStudentFormItem"
> showHelp="none"
> label=" #{giamsBundle['lbl.full.time.student']}">
> <h:selectBooleanCheckbox id="fullTimeStudentChkBox"
> value="#{pc_AssigneeDependents.dependent.isFullTimeStudent}"></h:selectBooleanCheckbox>
> </hx:formItem>
The value on
is the default HTTP request parameter value for a checked checkbox. You're apparently grabbing it raw from the request parameter map instead of accessing it by the property as bound by the input element's value
attribute.
Don't use the request parameter map, just access it in the AssigneeDependents
managed bean by dependent.getIsFullTimeStudent()
which in turn should be a boolean
or Boolean
.
精彩评论