The JavaScript you've used is working perfectly also when you change the value its getting changed, however to reflect these changes on the facelet you need to update the component which is holding the value of you've changed.
The f:ajax
tag will do the needful here, as it will update the all the components on the facelet whose id is provided in the render
attribute. Hence the below code will update the other component each time some action is performed on any of the h:selectOneRadio
.
<h:selectOneRadio id="encrypted" value="#{uploadFileBean.encryption}" onclick="radioSelect(this);">
<f:selectItem itemLabel="Yes" itemValue="true"></f:selectItem>
<f:selectItem itemLabel="No" itemValue="false"></f:selectItem>
<f:ajax render="protected">
</h:selectOneRadio>
<h:selectOneRadio id="protected" value="#{uploadFileBean.fileprotected}">
<f:selectItem itemLabel="Yes" itemValue="true"></f:selectItem>
<f:selectItem itemLabel="No" itemValue="false"></f:selectItem>
<f:ajax render="encrypted">
</h:selectOneRadio>