You can do this using Primefaces.
In your SelectOneMenu it would have the following properties:
- a property called required="true" that would say the field is required.
- a property called requiredMessade="Your message" where you would say which message you want to add.
Above your form would have a message field to be shown, which could look like this:
<p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />
On your button you would need to add the following properties:
- ajax="true" to validate using ajax.
- immediate="false" (if true it will not do screen validations)
Or, if you do not want to use primefaces, you could put a message using Faces after the click of the button on your Bean, like this:
FacesMessage facesMessage = new FacesMessage(FacesMessage.SEVERITY_INFO, "Qual a mensagem", "O que dizer na mensagem");
Any questions you can check on primefaces' own site:
link