Download
FAQ
History
HomeHomeNext API
Search
Feedback
Divider

About the Examples

The Java WSDP 1.2 release includes four complete, working examples, which are located in the <JWSDP_HOME>/jsf/samples directory. Table 21-1 lists the examples and where they are located.

This tutorial uses the cardemo and guessNumber to explain JavaServer Faces technology. It also uses some extra code snippets not contained in cardemo or guessNumber to explain features not demonstrated by these applications.

Table 21-1 Examples 
Example
Location
Function
cardemo
<JWSDP_HOME>/jsf/samples/cardemo
A car store application
guessNumber
<JWSDP_HOME>/jsf/samples/guessNumber
Duke asks you to guess a number
non-jsp
<JWSDP_HOME>/jsf/samples/non-jsp
Demonstrates non-JSP rendering
components
<JWSDP_HOME>/jsf/samples/components
Showcases tabbed-panes, tree-control, and result-set custom components

Running the Examples Using the Pre-Installed XML Files

The Java WSDP 1.2 includes an XML file for each example application in the <JWSDP_HOME>/webapps directory. This file causes an application to be automatically deployed when you start Tomcat. To run an example that is already deployed:

  1. Add the following to the front of your PATH:
    • <JWSDP_HOME>/bin and ANT_HOME/bin if you are running UNIX
    • <JWSDP_HOME>\bin and ANT_HOME\bin if you are running Windows
  2. On a system running the Solaris or Linux operating system, go to the <JWSDP_HOME>/bin directory and execute the catalina.sh script to bring up the Java WSDP. On a system running Microsoft Windows, from the Start menu, select ProgramsRight ArrowJava Web Services Developer PackRight ArrowStart Tomcat.
  3. Once the server is up and running, point your browser to http://localhost:8080, the default port at which the process is running. The page that is displayed contains links to several sample programs and administration tools.
  4. Click on one of the links to run the corresponding example.

Building and Running the Sample Applications Manually

It is also possible to build each of the sample applications manually. Before doing so, you need to set the environment variables, as described in Running the Examples Using the Pre-Installed XML Files and edit your build.properties file.

To edit the build.properties file:

  1. Go to the <JWSDP_HOME>/jsf/samples directory.
  2. Copy build.properties.sample to build.properties. This file provides build properties for all of the samples.
  3. In build.properties, set tomcat.home to JWSDP_HOME.
  4. Set the username and password to the username and password you configured for the user who has the manager role in the Java WSDP.

To build a sample:

  1. Shutdown Tomcat if it's running by executing either catalina.sh stop if you are running the UNIX operating system or catalina stop, if you are running Windows.
  2. Move the pre-installed XML files out of the <JWSDP_HOME>/webapps directory.
  3. Go to the directory of the example you want to build.
  4. At the command line, run Ant with no target:
      ant
  5. This will cause the sample to be built, and the WAR file for the sample to be put into the <JWSDP_HOME>/jsf/samples directory. The existing pre-installed XML files will cause tomcat to find your newly compiled sample.
Divider
Download
FAQ
History
HomeHomeNext API
Search
Feedback
Divider

All of the material in The Java(TM) Web Services Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.