开发者

checkbox value. getting strange value when checked/unchecked

开发者 https://www.devze.com 2023-01-12 09:59 出处:网络
i havea 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 t

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

精彩评论

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