This document describes the Employee Information
Application using Oracle9i XML features. This application tries
to demonstrate some of the useful XML features incorporated in Oracle9i
XDK(XML Developer's Kit) for Java. This application provides interface
for Adding, Updating, Deleting and Viewing of Employee Information
stored in the database. For performing the various database operations
and presenting data to the user the application makes use of the
XSQL pages feature that is available in Oracle9i XDK for Java.
The Oracle XSQL Pages publishing framework is
an extensible platform for easily publishing XML information in any
format you desire. It greatly simplifies combining the power of SQL,
XML, and XSLT to publish dynamic web content based on database information.
Using the XSQL publishing framework, anyone familiar with SQL can create
and use declarative templates called "XSQL pages" to:
1. Assemble dynamic XML "datagrams" based on parameterized
SQL queries, and
2. Transform these "data pages" to produce a final result
in any desired XML, HTML, or text-based format using an associated XSLT
transformation.
This application uses the XSQL pages alone to perform all database operations
insert, delete, update and select of information in the database. In
places, XSL(Extensible Stylesheet Language) is used to transform the
XML returned by the XSQL pages to HTML or XML.
XSQL Page actions
The XSQL Pages publishing framework provides
various core built-in actions that can be used to perform various database
operations. This application uses the actions <xsql:insert-param>,
<xsql:insert-request>, <xsql:update-request>, <xsql:delete-request>,
<xsql:dml> and <xsql:query> to insert, update, delete
and query employee information in the database.
These actions are used in the different XSQL pages of this application
to perform the database operations.
Dynamic Stylesheet
An XSQL Page can include an <?xml-stylesheet?>
processing instruction at the top of the file which will be considered
by the XSQL page processor for use in transforming the resulting XML
datagram. For example :
By including one or more parameter references in the value of the href
pseudo-attribute, you can dynamically determine the name of the stylesheet.
For example :
<?xml-stylesheet type="text/xsl"
href="@sheet"?>
In this application, the InsertParamXSL.xsql and GetEmployee.xsql pages
under the /xml directory assigns the stylesheet dynamically by picking
it from the request parameter called "XSL".
Bind and Lexical References in XSQL Pages
Bind: To parameterize the results of any of the XSQL actions,
one can use SQL bind variables. This allows an XSQL page template to
produce different results based on the value of parameters passed in
the request. To use a bind variable, one can simply include a question
mark anywhere in the statement where bind variables are allowed by SQL.
Lexical: For any XSQL action element, you can substitute the
value of any attribute, or the text of any contained SQL statement,
by using a lexical substitution parameter. This allows one to parameterize
how the actions behave as well as substitute parts of the
SQL statements they perform. Lexical substitution parameters can be
included using the {@paramname} notation.
For example :
<?xml version="1.0"?>
<page connection="otn9i" xmlns:xsql="urn:oracle-xsql">
<xsql:query bind-params="deptId maxSalary"
...>
select * from employees where department_id = ?
and salary <= ?
order by {@orderBy}
</page>
This application uses the bind and lexical references in the different
XSQL pages. Especially, the EmpQuery.xsql page uses bind and lexical
refereces for building the query with the inputs provided by the user.
For more information about Oracle XML features please visit /tech/xml/index.html
Please
go through the Install.html and set up the
application.
Visit
the application home page Welcome.jsp and click on the options "Add
Employee Information", "Edit Employee Information" or
"View Employee Information".
Add
Employee Information option provides the interface to insert new Employee
records into the database. Follow the instructions on the Add Employee
Information page to add employee information to the database.
Edit
Employee Information option provides the interface to Update / Delete
existing Employee records in the database. Follow the instructions on
the Edit Employee Information page to perform the desired operation.
View
Employee Information provides a form where one can provide the criteria
for viewing select information from the Employees table in the database
in XML format.
This page forms
the main page for Adding Employee Information into the database.
AddLeft.jsp
This page forms
the source for the left frame of the Add Employee Information
page.
AddForm.jsp
This page generates
the different HTML forms required for the user to input the
Employee Information.
EditEmployee.jsp
This
page forms the main page for Editing Employee Information into
the database. This page provides options for updating and
deleting Employee information.
EditLeft.jsp
This
page forms the source for the left frame of the Edit Employee
Information page where the update/delete options are displayed.
EditRight.jsp
This
page displays the instructions for using the options displayed on
the Edit page.
ViewEmployee.jsp
This
page forms the main page for Viewing Employee Information into
the database.