Oracle Application Server Containers for J2EE 10g (10.0.3) Developer Preview

Date:08-Sep-2003

Demo: JSP 2.0: Tic-Tac-Toe Demo

This demo illustrates the following JSP 2.0 features:

  • Use of simple tag handlers in JSP pages
  • Nesting of simple tag handler calls
  • Setting and accessing Page and Session Scoped context variables
  • Usage of EL(Expression Language) in JSP pages to access scoped variables

  •  

This demo simulates game of randomized tictactoe where "X" and "O" are marked randomly on tiles which also shuffle
in a random manner on every move of the game.

Software Requirements

Following are the software required for running and deploying this How-To.

  • OC4J 10g (10.0.3) is installed, available from OTN.
  •  
  • Sun's JDK 1.4.x is installed, available here.

Notation

  • %OC4J_HOME% - The directory you installed OC4J.
  •  
  • %J2EE_HOME% - The directory where the oc4j.jar file exists within OC4J. This is typically 2 directories under %OC4J_HOME%. For example, if you installed OC4J to c:\ then %J2EE_HOME% would be c:\j2ee\home.
  •  
  • %JAVA_HOME% - The directory where your JDK is installed.

Introduction

OC4J 10g ( 10.0.3) is the J2EE 1.4 preview release. JSP 2.0 is a major new addition to J2EE 1.4.  Along with the software, a number of how-tos are available that illustrate use of new J2EE 1.4 features.

In the zip you just extracted you will find ready to deploy tictactoe.ear.Upon deploying the tictactoe.ear file (instructions given below), you will find a detailed explanation of the demo along with access to all the source code.

Prerequisites for running the Demo

Before running the example make sure:

  • You have OC4J 10g (10.0.3) Developer Preview installed.

The contents of the ZIP file when extracted should include :

  • This file - estore-demo.html
  • tictactoe.ear - Ready to deploy

Deploying the application

To deploy to oc4j 10g ( 10.0.3) use admin.jar utility.  The admin.jar utilty is located at %J2EE_HOME%.  Run the following two commands to deploy and bind your application.

a)  To deploy
     java -jar admin.jar ormi://<host>:<ormi-port > < uid> <pwd>
                                                    -deploy -file <path-to-file>/tictactoe.ear
                                                    -deploymentName tictactoe

b) To bind the URI for the web module
     java -jar admin.jar ormi://<host>:<ormi-port > < uid> <pwd>
                                                    -bindWebApp tictactoe tictactoe-web http-web-site /tictactoe
 

   The default ormi port number is 23791 and the default password for the admin user is welcome.

Running the Application

To run the Tic-Tac-Toe demo application use the URI you bound in step (b).
http://hostname:8888/tictactoe

Review the index page to understand the demo, how it works and how the new features listed in the Introduction section of this document are put to use.

List of JSP 2.0 How-tos/Demos of Interest

  • How-to-tagfile - A tag file how-to example that connects to Oracle database, retrieves employee details from HR schema and demonstrates JSP 2.0 simple attributes, dynamic attributes by changing the SQL query and JSP 2.0 fragments by changing the look (color) of rows based on certain conditions being met.  This is a tutorial style how-to taking you step by step.
  • How-to-SimpleTag-Handler - This is also a tutorial style how to that illustrates creation and use of Simple Tag Handler class.  It uses similar scenario as in How-to-tagfile.
  • Estore Demo - This demo illustrates tag files, JSTL, EL and other JSP 2.0 features. The demo is about the estore web front changing it look and feel based on the occasion and promoting the appropriate products for the occasion.
E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy