Level: Intermediate Brian M. Carey (careyb@triangleinformationsolutions.com), Information Systems Consultant, Triangle Information Solutions
07 Jul 2009 Discover how you can get the full benefit of using XQuery technology
together with Asynchronous JavaScript and XML (Ajax). Your Web application will have the back-end benefit of
sophisticated XML querying as well as the client-side benefit of rich
presentation without the distraction of repeated requests.
Before you start
Discover what you need to get the most from this tutorial.
About this tutorial
Ajax is an acronym for Asynchronous JavaScript +
XML. XQuery is a technology used to query Extensible Markup Language
(XML) documents. Together, these technologies provide a powerful means of
creating rich Web applications that facilitate client-side dynamic content
derived from XML document queries—an excellent solution for
applications that require data access against an XML document as opposed to
a relational database. And, because XML is quickly becoming the generally
accepted means of information interchange (especially when platform
independence is required), the necessity of querying against XML to present
information in a Web application is growing in popularity. A Web
application implementation that uses Ajax together with XQuery can enable
complex queries against data stored in an XML format and cleanly present
the information to the user.
This tutorial explains how to create a Web
application—called FishinHole.com—that
uses these two powerful technologies together. The Web application uses
Java™ enterprise technology with the popular Spring
framework. You also use DataDirect's XQuery application programming
interface (API), or XQJ, for XQuery purposes. Finally, you deploy
the application to an Apache Tomcat server. You can then access the
application with a standard Web browser and see the benefits of using
XQuery with Ajax.
Objectives
In this tutorial, you first learn a bit about XQuery—what it
is and how it works. Next, you learn about Ajax and its place in Web
applications. The requirements for the sample Web application are
established, and the tutorial guides you through the process of creating a
"basic" Web application using Spring. You also create a basic Web
application that does not use Ajax and XQuery, which will enable you
to see how things work without XQuery and Ajax so that you can understand
the advantages of using these technologies together. Finally, you're guided
through the process of modifying the Web application to use Ajax and
XQuery.
Prerequisites
To use this tutorial, you should have a basic understanding of Web
application development and deployment as well as a basic understanding of the Java programming language, XML, HTML, and the JavaScript language. Ideally, you should
also understand Tomcat server administration.
System requirements
To run the examples in this tutorial, you need a platform that can support
the Apache Tomcat
application server. The tutorial assumes that the server will run on a
Microsoft® Windows® platform, but
UNIX®-savvy users will certainly be able to make the appropriate
adjustments to enable implementation on that platform, as well.
You also need the Spring
framework, as that is the tool that you use to implement the
Model-View-Controller (MVC) pattern in the Web application. This framework
is also used for dependency injection.
Finally, you must have the XQJ library. This is the API that the application uses to actually
perform the XQuery processing.
|