JSF & PrimeFaces & Spring tutorial 18: PrimeFaces Dialog

Creating custom dialog with PrimeFaces.

download result: https://app.box.com/s/c7ybm46b725ttws2cn2l

NEXT BATCH OF VIDEO TUTORIALS ABOUT JSF / PRIMEFACES WILL BE IN SUMMER 2015

index.xhtml:
<p:commandButton value="edit" action="#{checkListController.setCheck(check)}" 
	update=":checkForm" />
index.xhtml:
<h:form>
	<p:commandButton action="#{checkListController.clear()}" oncomplete="PF('checkDialog').show()" 
		value="add check" resetValues="true" update=":checkDialog" />
</h:form>

<p:dialog widgetVar="checkDialog" closeOnEscape="true" modal="true" header="check" id="checkDialog">
<h:form id="checkForm">
<p:messages />
	<p:focus />
	<p:panelGrid columns="2">
		name:
		<p:inputText value="#{checkListController.check.name}" />
		
		url:
		<p:inputText value="#{checkListController.check.url}" />
	</p:panelGrid>
	<p:commandButton value="save" action="#{checkListController.save()}" 
		update="checkForm, :checkTable" oncomplete="handleDialogSubmit(args, 'checkDialog')" />
</h:form>
</p:dialog>

<script type="text/javascript">
    function handleDialogSubmit(args, dialogName) {
        if (!args.validationFailed) {
            PF(dialogName).hide();
        }
    }
</script>
CheckListController:
	public void clear() {
		check = new Check();
	}