View Source

h1. Using Single Submit Tutorial

JSF 2.0 added the {{<f:ajax>}} tag that was very useful for creating the rich, interactive forms that users expect to see in a modern web application. ICEfaces 2.0 leverages and improves this new functionality with the {{<icecore:singleSubmit>}} tag. Single Submit is a replacement for the {{partialSubmit}} attribute common on ICEfaces 1.8.x applications. By using Single Submit we can send only some of the fields in a form to the server for processing, which can be handy as we can dynamically modify the form based on what was sent. For example in-line validation can be fired, different fields can be rendered depending on what the user has selected, and so on.

This tutorial will deal with using the {{<icecore:singleSubmit>}} tag in a simple form page. This tutorial assumes the reader has an understanding of JSF and ICEfaces and creating and working with projects related to those technologies. The focus is not to teach those basics, but instead to use Single Submit.

The goal of this tutorial is to create a basic ICEfaces 2.0 project and add Single Submit. The example will be a single page form with a few input components to demonstrate how Single Submit works.
\\
\\
----
{panel}Here is the entire list of steps worked through during this tutorial:

# [Make the easyAjaxPush Project|#step1]
# [Add ICEfaces and ICEpush|#step2]
# [Create color.xhtml|#step3]
# [Create MessageBean.java|#step4]
# [Create ColorBean.java|#step5]
# [Create TextModel.java|#step6]
# [Deploy the Application|#step7]
# [Adding Ajax Push|#step8]
** [ColorBean Setup|#step8a]
** [PushRenderer.addCurrentSession|#step8b]
** [PushRenderer.render|#step8c]
# [Re-Deploy the Application|#step9]
* [Tutorial Source Code Downloads|#downloads]
{panel}
----

h3. Development Tools Used

The following tools were used to create the project.
* [Eclipse|http://eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/heliossr1] IDE for Java EE Developers - Version Helios
* [Tomcat 7.x|http://tomcat.apache.org/download-70.cgi] Web Server
* [Java 6.x|http://www.oracle.com/technetwork/java/javase/downloads/]
* [ICEfaces 2.0 Beta 2|http://www.icefaces.org/JForum/posts/list/17890.page] with ICEpush

h3. {anchor:step1}1. Make the {{singleSubmit}} Project

* Using Eclipse create a new Dynamic Web Project called {{singleSubmit}}.
** Target runtime: Apache Tomcat v7.0
** Dynamic web module version: 3.0
** Configuration: JavaServer Faces v2.0 Project (Mojarra)

h3. {anchor:step2}2. Add ICEfaces

Add the {{icefaces.jar}} to your project from the ICEfaces 2 bundle. This can be added to the project through a custom User Library or by putting it into {{windowScope/WEB-INF/lib/}}. The approach doesn't matter as long as the jar is included in the deployed {{war}} file.

h3. {anchor:step3}3. Create {{form.xhtml}}

Create a new page called {{form.xhtml}} and paste the code below: