Some reader favorites:
EJB fundamentals and session beans
Create a scrollable virtual desktop in Swing
Wizard API updated!
Tim Boudreau has released a new version of the Swing Wizard library (version 0.997) that fixes the WizardException bug reported in JavaWorld's recent Open Source Java Project profile. The article's examples have been reworked to test out the new, improved WizardException. Thanks, Tim, for this helpful fix!
Open Source Java Projects: The Wizard API
In my previous article, "Put on a Happy MyFace" (July 2006), I showed how to use the JavaServer Faces (JSF) MyFaces component-based framework to create an employee header/detail use-case. Other functionality needs to be added to this application, such as the ability to add or delete an employee. In this article, I not only introduce these new functions, but also demonstrate how to use AJAX (Asynchronous JavaScript and XML) to improve the JSF Web application user experience. AJAX is an old technology with a new life. One of the biggest advantages of AJAX is that it improves the user's experience. In traditional Web applications, the entire Web content is rendered for every HTTP request every time. With AJAX, only a portion of content is rendered. Put simply, users can have a similar or the same experience working with a Web application as they have when working with a Windows-based application. JSF and AJAX are a perfect match when it comes to building a so-called RIA (rich Internet application). You want to know how? Just follow me.
Before I begin adding the new functions, I want to show you how to upgrade MyFaces from version 1.1.1 to the latest version, 1.1.3, which features many improvements and bugs fixes. One benefit for us using 1.1.3 in this use-case is that the version 1.1.3 tab panel has improved the tab's look and feel. It also provides a stable foundation for me to use AJAX, which I will detail in a subsequent section. To upgrade MyFaces 1.1.1 to 1.1.3, please follow the steps below:
<filter-name>extensionsFilter</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
In addition to the MyFaces version upgrade, I also changed the employee use-case package name to better present the data model classes and JSF managed beans.
Now that I have refactored the code and upgraded MyFaces, I am ready to add the two new functions. As shown in Figures 1 and 2, I want to create an Add button at the bottom of the Employee Information screen and add a delete function, represented by a trash can icon, to the list of employees.
Figure 1. Add employee to list. Click on thumbnail to view full-sized image.
Figure 2. Delete employee from list. Click on thumbnail to view full-sized image.
When users click on the Add button, the information entered in the employee detail section will be added to the list (see Figure 3).
To add this functionality, in the employee.jsp, I use the <t:commandButton> MyFaces component and associate the action with employeeTable.addEmployee; see Listing 1:
| Subject | Replies |
Last post
|
|
By |
0 |
10/06/06 04:23 AM
by Anonymous |
|
By JavaWorld
|
0 |
10/05/06 06:24 AM
by JavaWorld |
Free Download - 5 Minute Product Review. When slow equals Off: Manage the complexity of Web applications - Symphoniq
![]()
Free Download - 5 Minute Product Review. Realize the benefits of real user monitoring in less than an hour. - Symphoniq