Philip Chauvet does Java, J2EE, Web and Application Development. This sample J2EE Compliant Web Site uses these technologies

Specification   Methodology  Top Level Files
Instructions:
    Source Code  Build App (Ant) 
    Deployment   Running App   
    To Do   My Work           

JavaJ2EE , XML, and  Ant

 Back to the Web Application Demo
 Download (pchauvetDemo.zip)

Top
[Specification and Requirements - Use Cases] Top

 pgLogin.jsp - User Logs-In or Logs-Off. 

Business Rule:

Userid and Password are required. 

Processing  Rules: 

Struts form validation.
After logging-in the user name is displayed at the top of the page.
After logging-off the user name is cleared from the top of the page.
User can not log-off unless they are logged-in.

 

 pgCrtProfile.jsp - Creates a user profile. 

Business Rule:

The Userid, Password, Firstname, Lastname and Email are required.

Processing  Rules:

Struts form validation.
A user profile can only be created if the user is not logged-in.   If logged-in, the user can only update their profile.

 

 pgUpdProfile.jsp - Update a user profile. 

Business Rule:

The Userid, Password, Firstname, Lastname and Email are required.

Processing  Rules:

Struts form validation.
A user profile can only be update  if the user is logged-in.

 

 pgBusiness.jsp - The business of the Demo Web Application. 

Business Rule:

Getting Philip Chauvet Java and J2EE work!   

Processing  Rules:

A user can access this page only after they have logged-in.

[Methodoloy] Top
  • This sample J2EE website was developed using primarily the J2EE Model View Controller (MVC) design pattern, since we are using a web based application.  I am using Struts technology to embody this technique.
  • The Composite View design pattern is heavily used to separate the page layout for easier deployment in an Enterprise Development Environment. Simple JSP, Servlet includes would have work. My sample site links below will demonstrate this.
  • Struts also provides the Front Controller design pattern, its use servlets as a traffic cop to accept request and dispatch it to the correct form validation, business logic handler [servlet, javabean or Enterprise JavaBeans EJB)]. Also, direct responses to the correct JSP page or view. 
  • My www.howtoplace.com site below does this using servlets and good old fashion javabean to provide access to database services, plus use service management servlets to handle processing requests. 
  • This Demo Web Application uses Struts and XML to do it. It's easier to maintain and provide for fast application extensibility and re-deployment.
 [Top Level Files] Top
index.hml - Uses HTTP redirect to go to the index.jsp. Its an easy way to point other pages.
index.jsp - Home page. Click [Login] to Log-in, or Register as a New User.
pgLogin.jsp - User Logs-In or Logs-Off. 
pgCrtProfile.jsp - Creates a user profile. 
pgUpdProfile.jsp - Update a user profile. 
pgBusiness.jsp - The business of the Demo Web Application. 
[Source Code] Top
  • The Javabean, JSP, Servlet (*.java), J2EE configuration file (Web.xml), Strut support files (*.xml, *.properties, *.tld) and the Ant build file (build.xml) are located in the pchauvetDemo.zip file. Extract this file to a temporary directory. 
  • *** Important!  ***  A ready-to-go J2EE Web Archive file (pchauvetDemo.war) is also enclosed in the pchauvetDemo.zip file. It can be placed directly into the Jakarta Tomcat Server environment, in the /webapps/ directory.  Move this file to a save place before building the Demo application.
[Building the Demo Web Application]Top
  • *** Important!  ***  The Ant runtime executable (ant.bat)  must be available to build the application. 
  • Go to the temporary directory above and execute the ant executable. 
  • It will use the build.xml file to create the  pchauvetDemo.war file. 
[Deployment]  Jakarta TomcatWeblogicBlazixIBM DB2OracleMicrosoft Access   Top
                    [Deployment: The Jakarta Tomcat 3.2.3  and 4.1.12 Server ]Top
  • Place the generated pchauvetDemo.war into the Tomcat /webapps/ directory.
  • Start Tomcat. 
  • Tomcat will automatically create a directory /pchauvetDemo/ under the /webapps/ directory. 
  • In our environment, the Demo Web Application ran successfully in the Jakarta Tomcat Server version 3.2.3  and 4.1.12 in the Windows NT 4.0/2000 environment. 
                    [Deployment: The Weblogic Server 7.0 and 8.1 ] Top
  • Place the generated pchauvetDemo.war into a Weblogic server domain directory.
  • Use the Weblogic Console to load and deploy the application. 
                    [Deployment: The Blazix Enterprise Javabeans (EJB) Server Configuration] Top
  • On Tomcat, the EJBs are not deployed using an .ear (Enterprise Archive File). Instead  .jar (Java Archive File) files are used.  I wanted to see the details of the deployment process without the user of an EJB container.
  • There are two .jar files: SECUREUSEREjb.jar and the UserProfileEjb.jar used to provide the JDBC connectivity to, preferably, the IBM DB2 database. For expediance Microsoft Access can also be used.  See the steps below. These jar files are located in the /webapps/pchauvetDemo/WEB-INF/classes/ directory.

  • Blazix is a small memory  foot-print EJB Server that is easy to deploy and use. Any other EJB server can be used. You will have to figure out how to use the .jar files.
  • ** Note: The Port my code is directed to is blazix default port: 2050
  • Go to the www.blazix.com to download a copy. 
                    [Deployment: IBM DB2 Database Version 7 and the Blazix EJB Server Configuration] Top
  • Use the IBM DB2 Control Center to create a SECUREUS database: Select the Database root as shown, click the right-mouse key to select the Create-->Database Using Wizard and enter SECUREUS as the database name.
  • Once the SECUREUS database is created go to the IBM DB2 Command Center and make use semicolon ";" is entered in the "Use statement termination character" option from the Tool-->Tools Setting menu option as shown.

 

  • There is a SECUREDB2.SQL script file provided along with the pchauvetDemo.zip  file in the /DatabaseSQL/ directory. It will be used to create the SECUREUSER and USERPROFILE table for the SECUREUS database.
  • Select the Script tab from the Control Center and paste the SECUREDB2.SQL script into the script text area. Click the Execute icon to create the SECUREUS database tables.
  • I used the Blazix EJB Server to serve up these EJBs and access IBM DB2 as a datasource.
  • In the Blazix ejb.ini file add these configuration parameters to setup and access the EJB and the IBM DB2 Database DataSource:

############################################
#The setup for IBM DB2 v7.1 Begin
#**Important: You may have to change db2admin/aiki 
#                     user and password to your schema's value.
############################################
dataSource.name: SECUREUSER
dataSource.SECUREUSER.driverClass: COM.ibm.db2.jdbc.app.DB2Driver
dataSource.SECUREUSER.url: jdbc:db2:SecureUs
dataSource.SECUREUSER.username: db2admin
dataSource.SECUREUSER.password: aiki

#The EJB deployment of the SECUREUSER Login
ejbJar: <TOMCAT_HOME>\lib\SECUREUSEREJB.jar
ejb.SECUREUSER.dataSource: SECUREUSER
ejb.SecureUser.table: SecureUser

#The EJB deployment of the SecureUser Login
ejbJar: <TOMCAT_HOME>\lib\UserProfileEJB.jar
ejb.UserProfile.dataSource: SecureUser
ejb.UserProfile.table: UserProfile
############################################
#The setup for IBM DB2 v7.1 End
############################################

                    [Deployment: Oracle 8i Database and the Blazix EJB Server Configuration] Top
  • Use the Oracle Server Manager or  Oracle's  SQL Plus to create a SECUREUSER database.
  • Note: To create my Oracle database the SYSTEM/WESEE user password was used.
  •            You should use your SYSTEM password, or the default from Oracle: MANAGER.
  • I used the Blazix EJB Server to serve up these EJBs and access Oracle  as a datasource.
  • In the Blazix ejb.ini file add these configuration parameters to setup and access the EJB and the Oracle Database DataSource:

############################################
#The setup for Oracle v8i Begin
############################################
dataSource.name: SecureUser
dataSource.SecureUser.driverClass: oracle.jdbc.driver.OracleDriver
dataSource.SecureUser.url: jdbc:oracle:oci8:@secureuser
dataSource.SecureUser.username: dbuser
dataSource.SecureUser.password: dbuser

#The EJB deployment of the SecureUser Login
#ejbJar: D:\jakarta-tomcat-3.2.3\lib\SecureUserEJB.jar
ejbJar: E:\EJBApp\SecureUser\SecureUserEJB.jar
ejb.SecureUser.dataSource: SecureUser
ejb.SecureUser.table: SecureUser

#The EJB deployment of the SecureUser Login
ejbJar: E:\EJBApp\UserProfile\UserProfileEJB.jar
ejb.UserProfile.dataSource: SecureUser
ejb.UserProfile.table: UserProfile
############################################
#The setup for Oracle v8i End
############################################

                    [Deployment: Microsoft Access Database and the Blazix EJB Server Configuration] Top
  • In case you do not have IBM DB2, Microsoft Access can be used as a database. This is not an enterprise solution for sure, but you can get the Web Application up and running using Microsoft Access.
  • The  Microsoft Access SecureUser.mdb file is provided in the pchauvetDemo.zip file in the /DatabaseSQL/ directory.
  • You have to create an ODBC instance using the SecureUser name.
  • I used the Blazix EJB Server to serve up these EJBs and access Microsoft Access as a datasource.
  • In the Blazix ejb.ini file add these configuration parameters to setup and access the EJB and the Microsoft Access DataSource:

############################################
#The setup for Microsoft Access Begin
############################################
dataSource.name: SecureUser
dataSource.SecureUser.odbc: SecureUser
dataSource.SecureUser.url: jdbc:odbc:PropsOdbc

#The EJB deployment of the SecureUser Login
ejbJar: <TOMCAT_HOME>\lib\SecureUserEJB.jar
ejb.SecureUser.dataSource: SecureUser
ejb.SecureUser.table: SecureUser

#The EJB deployment of the User Profile
ejbJar:  <TOMCAT_HOME>\lib\UserProfileEJB.jar
ejb.UserProfile.dataSource: SecureUser
ejb.UserProfile.table: UserProfile
############################################
#The setup for Microsoft Access End
############################################

                    [Deployment: EJB on Tomcat and EJB .jar files ] Top
  • On Tomcat, the EJBs are not deployed using an .ear (Enterprise Archive File). Instead a .jar (Java Archive File) is used. There are two .jar files: SecureUserEjb.jar and the UserProfileEjb.jar deployed in the /webapps/pchauvetDemo/WEB-INF/classes/ directory.
  • Copy these two files into the /lib directory of Tomcat. 

Note: To access the IBM DB2 JDBC driver using Java SDK 2.0 run the %db2path%\java12\jdbc20.exe to 
create the Java 2.0 IBM DB2 database driver (db2java.zip). Here is my setenv.cmd file used in 
Windows 2000 before running the Blaxiz (blxejbs.exe) command:

echo off
cls
set java_home=d:\jdk1.3.1_04
set j2ee_home=d:\j2sdkee1.3.1
rem ***
rem Have to run the %db2path%\java12\jdbc20.exe to create the Java 2.0 
rem IBM DB2 database driver
rem
set db2path=D:\Program Files\SQLLIB\
set jdk3classes=.;%java_home%\lib\tools.jar;%java_home%\dt.jar;%ant_home%
set j2eeclasses=.;%j2ee_home%\lib\j2ee.jar;%j2ee_home%\lib\locale;
set window_home=.;C:\WINNT\system32;
set other_home=c:\batch;.;c:\

set path=%java_home%\bin;%j2ee_home%\bin;%window_home%;%other_home%;%ANT_HOME%\bin;%db2path%\bin     
set classpath=%jdk3classe\s%;%j2eeclasses%;%db2path%\java12\db2java.zip

  • Once there, I used the Blazix EJB Server to serve up these EJBs.
[Running the Demo Web Application] Top
Invoke the Blazix EJB Server
  • If you are using the IBM DB2 as a datasource , run the setenv.cmd before initiating the Blazix EJB Server. This step is not necessary for the Microsoft Access database.
  • Run the Blazix EJB Server by invoking the blxejbs.exe command.

Start up the Apache Tomcat Server

  • Once Tomcat has started go to the browser and issue:  http://localhost:8080/pchauvetDemo/
  • Note my Tomcat used the port 8080, If you used the default port 80 simply type: http://localhost/pchauvetDemo/

Test User ( me / me )

  • As part of the IBM DB2 database creation and included in the Microsoft database, a sample test user is created using me for the User ID and Password.
  • Click the [Log-In/Log-off] button to go to the PgLogin.jsp page.
  • Type me for the User ID and Password. This will bring up the test user record. 
[To Do]Top
  • Use XML  DataSource  to provide persistent data storage and database.
  • Use an Orace DataSource.
  • Fully provide a J2EE Application .ear file (Enterprise Archive File) under IBM Websphere and Weblogic.
[Some of My Work]
   http://www.howtoplace.com/
   http://www.africaorb.com/
   http://www.aikiinc.com/
   Training
       www.aikiinc.com/jmstutorial (My J2EE JMS online Tutorial)
       www.aikiinc.com/ejbtutorial (My J2EE EJB online Tutorial)
Top                                                                         Back to the Web Application Demo

Thank you for the opportunity to show my work!
I can be reached at  (718) 241-3602  or  abc1260@aol.com