Building an Ajax Chat Room with the Ajax Transaction Dynamic Faces Component
By dananourie on Apr 09, 2008
In this tutorial, you build an Ajax chat room web application with components that are themselves Ajax-unaware, also known as POJC (Plain Old JavaServer Faces Components). You achieve this using Dynamic Faces technology, an extension to JavaServer Faces technology that lets you easily implement Ajax functionality. In particular, you use the Ajax Transaction component included with the Dynamic Faces component library (0.2), which lets you visually configure Ajax functionality at design time. The chat room application comprises one rendered page, shown below, and is entirely Ajax-based. No conventional page submissions occur. Specifically, an Ajax request is sent when the user sends a comment by typing text in the text field and clicking the Send button or pressing the Enter key. The page also uses Ajax requests to poll the server continually in order to update the transcript of comments.
- Tutorial Requirements
- Creating the Project
- Configuring the Deployment Descriptor
- Adding the Dynamic Faces Component Library to the Project
- Adding Code to the Application Bean
- Adding Code to Store the Username
- Adding the transcript Property to Page1.java
- Creating the User Interface
- Configuring Ajax Transactions for Sending Comments and Polling
- Deploying the Project
This tutorial works with the following technologies and resources
|JavaServer Faces Components/
Java EE Platform
|1.1 with J2EE 1.4|
|Travel Database||Not Required|
Before you begin, you need to install the following software on your computer:
- NetBeans IDE 6.0 with Web and Java EE functionality (included in the Web and Java EE download and the All download). (download)
- Visual Web Samples Plugin. This plugin includes the Dynamic Faces Component Library (0.2). Follow the instructions in the section entitled "Installing the Plugin" in Installing the Visual Web Samples Plugin. Be sure to select the entries for both the Visual Web JSF Post Release Samples and the Visual Web JSF Backwards Compatibility Kit.
Follow the tutorial
Sun Student Courses
Real World Technologies: NetBeans GUI Builder, JRuby, JavaFX, and JavaME is an introduction level course that leads you to the basics of JavaFX, NetBeans GUI, JRuby, and JavaME programming. When you finish this course you will earn a certificate.