开发者

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="&nbsp;&nbsp;#{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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜