If you are using primefaces, you should try this:
XHTML:
<p:commandButton id="basic" value="Basic" onclick="PF('dlg1').show();" type="button" />
<p:dialog id="basicDialog" header="HELLO" widgetVar="dlg1">
<h:outputText value="Hello world!" />
</p:dialog>