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.
The following tools were used to create the project.
- Eclipse IDE for Java EE Developers - Version Helios
- Tomcat 7.x Web Server
- Java 6.x
- ICEfaces 2.0 Beta 2 with ICEpush
- 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)
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.
Create a new page called form.xhtml and paste the code below: