logo

JSF & PrimeFaces & Spring tutorial 13: PrimeFaces update

Using PrimeFaces update functionality to retrieve data from server using AJAX.

download result: https://app.box.com/s/2sgzxdgrx7zrt888ma78

index.xhtml:
<p:dataTable value="#{checkListController.checks}" var="check" id="checkTable">
	<p:column headerText="name">
		#{check.name}
	</p:column>
	<p:column headerText="url">
		<a href="#{check.url}" target="_blank">
			#{check.url}
		</a>
	</p:column>
</p:dataTable>

<h:form id="checkForm">
	<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" />
</h:form>
CheckListController:
	public void save() {
		checkService.save(check);
		check = new Check();
		checks = checkService.findAll();
	}

comments powered by Disqus

rss

Free online Java web application examples

Want to develop whole web applications which use database, security and more? See my github account, where are lot's of example projects:
github

Search