To understand this sample you
must have working knowledge of eXtensible Markup Language
(XML) , eXtensible Stylesheet Language (XSL)
and XSLTransform (XSLT) . You should have a conceptual background
of different kinds of character encodings. The sample has been
implemented in Java so it is expected that you are familiar with Java
and related technologies. Knowledge of J2EE web application architecture
would be an added advantage. Though not required; familiarity with Oracle
databases is desired.
Note : The message translations to French
have been done by an automated tool
Technical Overview
This sample application illustrates the following features:
Encoding XML documents in different character sets
( UTF-8, UTF-16, ISO-8859-1 )
Sending and receiving XML documents over HTTP along
with character encoding information
Using single style-sheet for multilingual HTML page
generation with the help of XSLT extension function facility provided
by Oracle XDK 10g
Storing XML documents in XMLType column of Oracle database
along with appropriate encoding
Generating XML documents on using Oracle XDK 10g
DOM API's along with encoding attribute
Application Overview
This application demonstrates a simple Real Estate portal
called as E*Stator.com. This sample application supports two languages, English
and French.
There are two groups of users who can use this applicaion.
The two roles are that of a user and an administrator.
User : Users can use this portal to search
for houses that are available for Rent or Sale. Administrator : The administrators are allowed to add, edit,
delete property records.
The entire application can be used in any of the two
supported languages. Whenever new property details are uploaded they
must be supplied to this application in an XML format. The encoding chosen
by the user is used to store the data in XMLType column and vice versa.
Application Design
This application has been implemented as a pure J2EE
web application. The user interface is generated using JSP's, XML and
XSL stylesheets. Any browser like IE 5.5.and later or Netscape 7.1 and
later can be used to view the application. The application extensively
uses Java API's and Oracle XDK 10g. Oracle XML DB ( Oracle
9.2.0.2 or later ) is used as a datastore.
This application demonstrates the usage of locale sensitive
transformations using XSLT extension. This is explained with the help
of the following diagram:
In this application, the User is allowed to choose language
as 'English' or 'French' and the choice is passed as a parameter to the
JSPs. However, in general, the Locale object is readily available through
the request object method getLocale() (the value gets set based on the
user preference set in the browser or operating system). For further
details on locale awareness and other details of determining the session
locale, please refer the Oracle
Application Server 10g Globalization Support Guide
Database Schema Design This application stores its information
in a relational table in Oracle database. The table has name "property_tab".
This table has 2 columns.
1. PROPERTY_ID VARCHAR2(20) PRIMARY KEY
2. PROPERTYXML XMLType
ScreenShot
This is how the main page of the E*Stator application
looks like.
Sample Application Files
This section provides a tabular listing of the
sample application files, along with their respective directory locations
and a description of what they do in the overall scheme of the application:
Readme file and Stylesheets
Directory
File
Description
Unicode\doc
Readme.html
This file
Unicode\doc
Install.html
This file has instructions required to deploy the
application.
Unicode\doc
otn.css
This XSL stylesheet is used in Readme.html
and Install.html files.
Unicode\doc
snapshot1.jpg
XSLTExt.gif
The image files used in Readme.html
file
Java Server Page files for the Application
Directory
File
Description
Unicode\public_html\
[ images ] directory
This directory contains all images required by this
application
Unicode\public_html\
[ WEB-INF ] directory
This directory contains the configuration files required to host
this application on Oracle Application Containers for J2EE
Unicode\public_html\
AddPropertyIFrame.jsp
This page is contained in the AddProperty.jsp
file. It allows E*Stator users to add a property record in the database.
Unicode\public_html\
AddProperty.jsp
This page contains the AddPropertyIFrame.jsp
file. It allows
users to add property entries in the E*Stator application
Unicode\public_html\
AddPropertySub.jsp
This page does
the actual work of inserting a property record in the database
Unicode\public_html\
AddPropertyEncodeSub.jsp
This page prepares
the HttpURLConnection by setting the encoding information and writes
the request to AddPropertySub.jsp to add new property details to
the database and displays the response.
Unicode\public_html\
AddProperty.xsl
The stylesheet
used to generate AddProperty.jsp
Unicode\public_html\
ChoiceIFrame.jsp
This page is contained
in the Choice.jsp file. It allows
users to view all property records present in the database and allows
users to edit/delete them
Unicode\public_html\
Choice.jsp
This page contains
the ChoiceIFrame.jsp file. It allows
users to view all property records present in the database and allows
uers to edit/delete them
Unicode\public_html\
Choice.xsl
The stylesheet
used to generate Choice.jsp
Unicode\public_html\
Date.jsp
This page is used
by many other JSP's present in this application. This page returns
the current date along with some information like ISO Language
code. This page is supplied to the XSLT processor that uses XSLT
extension functions and respective XSL file to generate html pages
Unicode\public_html\
EditPropertyIFrame.jsp
This page is contained
in the EditProperty.jsp file. It allows users to edit property entries
in the E*Stator application
Unicode\public_html\
EditProperty.jsp
This page contains
the EditPropertyIFrame.jsp file. It allows users to edit property
entries in the E*Stator application
Unicode\public_html\
EditPropertySub.jsp
This page does
the actual work of updating a property record in the database
Unicode\public_html\
EditProperty.xsl
The stylesheet
used to generate EditProperty.jsp
Unicode\public_html\
Main.jsp
Main page of this
application. It provides access to different features of this application
Unicode\public_html\
Main.xsl
The stylesheet
used to generate Main.jsp
Unicode\public_html\
SearchListIFrame.jsp
This page is contained
the SearchList.jsp file. It displays a
listing of properties that meet the search criteria suppiled by
the user
Unicode\public_html\
SearchList.jsp
This page contains
the SearchListIFrame.jsp file. It displays a listing of properties
that meet the search criteria suppiled by the user
Unicode\public_html\
SearchList.xsl
The stylesheet
used to generate SearchList.jsp
Unicode\public_html\
property.xsd
This XML Schema
file contains the definition for PROPERTY schema
Unicode\public_html\
style.css
This stylesheet
contains styles used by many JSP's listed above
Java Source files for the Application
File
Description
Unicode\src\oracle\otnsamples\unixslt
AddPropLocalizer.java
Returns Locale specific resource name / prompt string
Unicode\src\oracle\otnsamples\unixslt
ChoiceLocalizer.java
Returns Locale
specific resource name / prompt string
Unicode\src\oracle\otnsamples\unixslt
DBBean.java
This class handles
all database interaction for the E*Stator application
Unicode\src\oracle\otnsamples\unixslt
DBStatus.java
This helper class
retains and returns the status of the database operation
Unicode\src\oracle\otnsamples\unixslt
EditPropLocalizer.java
Returns Locale
specific resource name / prompt string
Unicode\src\oracle\otnsamples\unixslt
MainLocalizer.java
Returns Locale
specific resource name / prompt string
Unicode\src\oracle\otnsamples\unixslt
PageParameters.java
This helper class
allows different JSP's to share Java objects with each other
Unicode\src\oracle\otnsamples\unixslt
ParseStatus.java
This helper class
retains and returns the status of the XML parsing operation
Unicode\src\oracle\otnsamples\unixslt
Property.java
This class stores
Java representation of Property XML document
Unicode\src\oracle\otnsamples\unixslt
SearchLocalizer.java
Returns Locale
specific resource name / prompt string.
Unicode\src\oracle\otnsamples\unixslt
XMLBean.java
This class
has methods that validate the property XML document against
the property schema. It also has methods that convert Java property
object in to its XML representation and vice-versa.
Unicode\src\oracle\otnsamples\unixslt
XSLTJavaBean.java
This java bean
class contains methods to perform XSL transformations required by
the application to display contents on the JSP page using the XSL
files provided for each JSP page
Unicode\src\oracle\otnsamples\unixslt
ConnParams.java
This java file
loads the connection parameters from 'Connection.properties' file
and initializes the static members.
Unicode\src\oracle\otnsamples\unixslt
Utilities.java
This java file
implements a set of utility methods.
Unicode\src
Connection.properties
This properties
file contains the connection properties required for this application.
Unicode\src
ApplicationMessages_en.properties
This properties
file contains the application message translations in English.
Unicode\src
ApplicationMessages_fr.properties
This properties
file contains the application message translations in French.
Other files/directories
File
Description
Unicode\sql
setup.sql
This SQL script generates database objects that are
required by this application.
Unicode\datafiles
*.xml
Sample XML files
Unicode\deploy
unicode.deploy
This deploy file is used by JDeveloper
to deploy the application to OC4J
Unicode
unicode.jws
unicode.jpr
Oracle JDeveloper 10g workspace and project files
Unicode
*.xml
Oracle JDeveloper
10g configuration files
Setting up the Sample Application
Refer the Install.html for step-by-step instructions
on extracting files, installing and configuring any other systems to successfully
Glossary/Bibliography
Term
Definition
Oracle Database 10g
Oracle's new flagship database with Grid Computing.
We hope you find this README file helpful. This
file was prepared by Abhijeet Kulkarni . For any additional help/information
please post your questions in the OTN
Sample Code Discussion Forum.
Oracle XDK 10g Unicode Support and XSLT Extension
Sample Application