Building an Ajax Chat Room with the Ajax Transaction Dynamic Faces Component

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.

Contents
-      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
-      Setting JavaScript Properties of the Body and Form Components
-      Adding JavaScript
-      Deploying the Project

 

This tutorial works with the following technologies and resources

JavaServer Faces Components/
Java EE Platform
works with1.1 with J2EE 1.4
Travel Database works withNot Required

Tutorial Requirements

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.

Ajax Chat Room Web Application



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.

 

 

Comments:

good tutorials

Posted by AJAX Chat Tutorial on May 21, 2008 at 08:12 PM PDT #

Post a Comment:
Comments are closed for this entry.
About

Java Technology Fundamentals are now covered as part of the Core Java Technology Tech Tips. Please go there for more tech tips.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today