Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Apache Shale Takes JavaServer Faces to the Next Level

Apache Shale, the newest sibling of the Struts framework, leverages JavaServer Faces to enable componentized presentation-tier development. Get started with Shale's Dialog Manager, Validations, and JNDI services.


advertisement
n its time, Struts was the MVC2 framework Its design elegance, simplicity, and robustness enabled a larger portion of Java developers to embrace Struts for presentation-tier development. But alas, it has been five years since Struts was conceived, and it has started to show signs of age. It has remained a monolithic request-processing engine that is hard to customize and extend, while JSF has established itself as a flexible, scalable event-processing engine. Secondly, Struts has failed to add support for declarative workflows, a consistent validation framework, or emerging technologies such as AJAX. This has led to a diminished role for Struts in new development projects.

However, the Struts development team is not idly standing by while JSF gains ground. Comprised of the best minds in the industry, the Struts team has re-invented itself and begun creating services that can supplement and enrich JSF rather than try to compete with it directly. They want to make a good thing (JSF) better. (If you are not familiar with JSF, read "Introduction to JavaServer Faces" and "Face Up to Web Application Design Using JSF and MyFaces" to get up to speed.)

The result is Apache Shale, a framework that builds on JSF's strengths. (I have no idea why the team chose the name Shale. Merriam-Webster defines it as some sort of fissile rock.) Shale provides componentized services that you can use selectively based on your needs. These services vary from as simple as a backing bean (Shale's View Controller) with a few extra functions to a full-fledged Web page navigation engine (Shale's Dialog Manager).



Shale brings quite a number of features to the JSF lineup—more than any one article can cover, so this article focuses on Shale's dialog manager, validation, and Java Naming and Directory Interface (JNDI) services, just enough to whet your appetite. These services will give you a good grasp of the variety, simplicity, flexibility, and strengths of Apache Shale.

Visit the Shale feature page for full descriptions of the following Shale services:

  • View Controller: Backing bean for JSP with predefined events
  • Validations: Client- and service-side validations
  • JNDI: JSP access to properties in web.xml
  • Dialog Manager: Web wizards (workflows) driven by XML configuration files
  • Application Manager: An application-level controller to intercept all HTTP requests
  • AJAX: A server-side service for AJAX support
  • Spring, Tiles, and Clay framework integration and reusable views
  • Test: Mock objects and base classes for JUnit-based tests

Start with Shale Downloads

Downloading Shale is a little involved because it is still in beta. You need to work with nightly builds (adrenaline fix!) from http://cvs.apache.org/builds/struts/nightly/struts-shale/.

Download the following four files with the latest dates in their names (The names of files will vary based on the day you download them.):

  • shale-framework-YYYYMMDD.{tar.gz,zip} – contains the binary and source of the core Shale framework
  • shale-starter-YYYYMMDD.{tar.gz,zip} – contains a template directory structure for a Shale-based application and Apache Ant as the build tool
  • shale-blank-YYYYMMDD.war – contains sample Shale Web application that shows current date and time
  • shale-dependencies-YYYYMMDD.zip – contains supporting JAR libraries required for Shale-based applications

The following were the latest Shale downloads on March 8, 2006:

shale-framework-20060308.zip shale-starter-20060308.zip shale-blank-20060308.war shale-dependencies-20060308.zip

"Sidebar 1. Get Started with Shale Starter Templates" provides a step-by-step guide for creating your own project from the Shale downloads. I used the same guidelines to create a Web registration application for a fictitious Shale launch party using Shale's dialog manager, JNDI, and validation services. Download this sample application now.

Unzip the download. This will create a 'launch-party' folder that contains 'lib' and 'src' folders, along with Apache Ant build files. The 'src' folder contains Java and JSP source files for the project. The 'lib' folder is empty. Build.xml and default.properties, found under the launch-party folder, are Apache Ant build files. Build.xml has various Ant build tasks that clean and create directories, copy files to build folders, compile and create war files, deploy to Tomcat, etc. I particularly like the 'dist' task, which among a plethora of other files also creates a deployable war file.

Before you jump to executing these Ant tasks, you need to perform the following two steps:

  1. Change the value of 'shale.dir' in launch-party\default.properties to your Shale installation directory.
  2. Copy the extracts of shale-dependencies-YYYYMMDD.zip to the launch-party\lib folder.

Be sure that you meet the software pre-requisites in the What You Need box before you go any further. When you are set, you will be ready to jump head first into Apache Shale Services.

What You Need
  • Apache Ant 1.6.5
  • Apache Tomcat 5.5.15
  • Apache Shale
  • Java Standard Edition JDK 1.4 or higher
  • Java Standard Edition JRE 1.4 or higher
  • (For those you who like to live on the edge, JDK and JRE 1.6-beta will do too.)


  • Comment and Contribute

     

     

     

     

     


    (Maximum characters: 1200). You have 1200 characters left.

     

     

    Sitemap