Home Page

Back to Papers


Introduction - Why WAP?

WML

XML

The Oracle XDK

An Example Application

Our first XSQL Page

Browser Sensitivity

A WML Stylesheet

WML Output

An HTML Stylesheet

Conclusion and Resources

Please note this page has moved to http://oracledoug.com/wap6.html. You will be redirected in 5 seconds but it would be better to update your bookmarks ;-)

Our First XSQL Page

The first prototype screen contains the five most recently posted jobs that match the user's search criteria. The value for the search string would be supplied when the user completes the WML form listed in example 1, although it could also be stored in one of a catalogue of user search profiles stored in the database in a real system. The screen only needs to access one table in the database - the JOB table and present an initial WML deck that contains a top level card with each job title forming a hyperlink pointing to a related card containing further details about the job. This allows the user to have a quick view of the jobs that have been posted and to retrieve more details about interesting-looking jobs quickly without resubmitting a new request.

I have added line numbers to help explain what the code is doing, but these would not be included in the real version.

Example 2 - JOBSERVE.XSQL (Version 1.0)

1. <?xml version="1.0"?> 2. <xsql:query mySearch="wap" 3. max-rows="5" 4. connection="Jobserve" 5. xmlns:xsql="urn:oracle-xsql"> 6. <xsql:include-request-params/> 7. SELECT substr(title,1,16) short_title, title, location, skills 8. FROM job 9. WHERE UPPER(title) LIKE UPPER('%{@mySearch}%') 10. ORDER BY first_posted DESC 11. </xsql:query>

Line 1 identifies this as an XML document that conforms to version 1.0 of the XML standard.

Line 2 is our first xsql tag which, with the matching tag at line 11, surrounds our XSQL query. It also includes the first attribute of the element - mySearch. This sets a default value for the parameter that may be passed from the user's browser request. i.e. If the user does not supply a value, the string "wap" will be used by default.

Line 3 restricts the number of rows returned by the XSQL servlet to 5. This ensures that the amount of data is limited, bearing in mind the low bandwidth of a WAP phone. This attribute can also be used with the skip-rows attribute to return multiple screens of data on separate trips to the database.

Line 4 specifies the database connection that will be used to submit the query. The connection details are part of the XSQL Servlet configuration, described in the release notes, but it's worth noting that this allows us to specify multiple queries against different databases as part of the same XSQL page.

Line 5 specifies the XML namespaces to be Oracle's, to prevent any potential conflicts with other XML dialects.

Line 6 ensures that any user-supplied value for the mySearch parameter is used in the query.

Lines 7 to 10 should look very familiar as they are an embedded SQL query. The only difference from a standard query is the use of the {@var} syntax to utilise the user-supplied parameter. There is one generated field containing a shortened version of the title, which might be useful for our main page hyperlinks.

We can request this page using Internet Explorer 5 or any other XML-enabled browser and the XSQL Servlet will submit the query to the database on our behalf and will return the 'raw' XML to the browser, as follows. (Note - if you want to see how your browser processes XML, click here.

Example 3 - JOBSERVE.XML (A section of the unaltered XML Output)

<?xml version="1.0" ?> <ROWSET> <ROW num="1"> <SHORT_TITLE>Oracle Database</SHORT_TITLE> <TITLE>Oracle Database Administrator - InvestmentBanking</TITLE> <LOCATION>Luxembourg</LOCATION> <SKILLS>Oracle Database Administrator For Financial Organisation. PL/SQL, SQL*Plus, Forms 4.5, Reports 2.5.</SKILLS> </ROW> <ROW num="2"> <SHORT_TITLE>Senior Analyst:</SHORT_TITLE> <TITLE>Senior Analyst: Oracle & Delphi</TITLE> <LOCATION>Leeds, West Yorkshire</LOCATION> <SKILLS>Senior Oracle & Delphi … … … </ROW> </ROWSET>

Looking at the output should highlight one of the advantages of XML - the ability to visually interpret what is going on because the tags are descriptive of the data. But even this isn't readable or useful to the average user of the service, so we need to convert it to our desired format using the XSQL Servlet's built in XSL Transformation (XSLT) processor ...

Previous


Technical Papers Utilities and Scripts Book Reviews Links
My Resume Fun & Games Email Home