Just let the required
attribute of the menu check if the checkbox is checked. You can do it by binding the physical checkbox component to the view by binding
attribute, which would make it to end up in an UIInput
instance which in turn has getValue()
method returning the submitted/converted/validated value.
<h:selectBooleanCheckbox binding="#{checkbox}" ... />
<h:selectOneMenu ... required="#{checkbox.value}" />
(note: the code is complete as-is, you do not need to bind it to a bean property!)
Note that this doesn't strictly "conditionally display the message" as you explicitly asked. It just conditionally validates the input as required. Whether the message is being displayed or not is merely a consequence.
See also:
Update: as per your attempt to check the <h:selectBooleanCheckbox value>
instead, this won't work as this value is only updated during update model values phase, which is after the validations phase when the required
attribute is to be checked.