spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / new / dynamic pages

Building Dynamic Pages with XML, XSL and JSP

Developer News
Metasploit 3.2 Offers More 'Evil Deeds'
'Thank You Apple. Seriously.'
The Buzz: BlackBerry App Store Seen Next

The Challenge

Web sites used to be fairly predictable beasts. Mix some HTML with some CGI and you have a basic page that responds to the user. Today, if your site isn't dynamic, it's dead or at least on the endangered species list. While older tools, such as PHP, get the job done and proprietary beasts, like Microsoft's Active Server Pages (ASP), lock you into a platform, emerging tools and standards are available to help you streamline development and serve up fresh, dynamic content to your visitors.

The Standards

This article walks you through the creation of a simple area code lookup form that uses a Java Server Pages (JSP) to retrieve data from a database, XML to hold the result of queries and XSL to put the finishing touches on the browser presentation.

JSPs are the open answer to ASPs. Simply stated, they are mixture of markup tags and Java code on the same page. You have the full power of Java and all it's class libraries to use in your development - including built-in database connectivity with the JDBC classes.

The Extensible Markup Language (XML) provides a structured way to represent information and can be used with the Extensible Stylesheet Language (XSL) to format and present a finished document for viewing. Internet Explorer 5.x is one of the best ways (as of this writing) to directly view XML/XSL documents, but you are able to run XML/XSL documents through other utilities to generate HTML (or XHTML output) for viewing by any browser.

The Application

The link to the full sources can be found at: www.cs.moravian.edu/~brudis/webreference/. This example application is based upon an area code database with three fields: area code, location (state), and description. From it, you can display the complete database, or lookup information on any one of the three fields - all with one JSP page.

If you do not have a Web server with inherent JSP capabilities, then I suggest going over to the Apache site and grabbing "Tomcat" - which is an open JSP/Servlet implementation under the Apache Software Foundation. IBM and Sun contribute to the project and it is a great starting point. Alternatively, you could use products like ServletExec and Jrun which provide similar functionality and can be added onto most modern Web servers and platforms.

To fully appreciate the power of the technology, you'll need to have the area code information stored in a database. If you don't have one handy, or dislike ODBC as much as I do, then grab a copy of MySQL and the JDBC driver for it. It's free, and easy to get setup and running.

Once you have a database and a JSP-engine, the application is a mere two files: areacode.jsp (which contains the form and lookup code) and areacode.xsl (which contains the presentation markup instructions). If you're running Tomcat, you can start the application by calling up a URL in IE: "http://www.some.svr:8080/areacode.jsp" provided you put the file in the "webpages" directory after the server build.

areacode.jsp is divided into three sections: the header, which contains the XML document tag and the JSP page directives; the HTML body, which is sent if there is no form input to process; and the JSP code that connects to the database and outputs XML tags.

Next: The Application continued, Resources

This article originally appeared in the February 24, 2000 edition of the WebReference Update Newsletter.


http://www.internet.com

Comments are welcome
Written by Bob Rudis and

JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
Avaya Article: Call Control XML - Powerful, Standards-Based Call Control
Tripwire Whitepaper: Seven Practical Steps to Mitigate Virtualization Security Risks
Internet.com eBook: The Pros and Cons of Outsourcing
Go Parallel Article: Scalable Parallelism with Intel(R) Threading Building Blocks
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Go Parallel Video: Intel(R) Threading Building Blocks: A New Method for Threading in C++
HP Video: Is Your Data Center Ready for a Real World Disaster?
Microsoft Partner Portal Video: Microsoft Gold Certified Partners Build Successful Practices
HP On Demand Webcast: Virtualization in Action
Go Parallel Video: Performance and Threading Tools for Game Developers
Rackspace Hosting Center: Customer Videos
Intel vPro Developer Virtual Bootcamp
HP Disaster-Proof Solutions eSeminar
HP On Demand Webcast: Discover the Benefits of Virtualization
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Microsoft Download: Silverlight 2 Software Development Kit Beta 2
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt
Iron Speed Designer Application Generator
Microsoft Download: Silverlight 2 Beta 2 Runtime
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
IBM IT Innovation Article: Green Servers Provide a Competitive Advantage
Microsoft Article: Expression Web 2 for PHP Developers--Simplify Your PHP Applications
Featured Algorithm: Intel Threading Building Blocks - parallel_reduce
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES
webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview · Controllers: Programming Application Logic - Part 2 · How to Use JavaScript to Validate Form Data
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Choosing the Right Online Backup Provider · Mother Avaya Nurtures Her Technology Partners · Software as a Service a Winning Model for Hotspot Provider

Revised: May 9, 2000

URL: http://webreference.com/new/dynamic.html