home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeJava and XSLTSearch this book

7.5. Finishing Touches

That about does it for the code walkthrough. Since this is a moderately large application, downloading the code from this book's web site is much easier than typing everything in by hand. Do not forget that several additional classes are listed in Appendix B, "JAXP API Reference".

7.5.1. Deployment

A deployment descriptor and WAR file are required to deploy and test the application. The deployment descriptor, web.xml, is shown in Example 7-39.

Example 7-39. Deployment descriptor

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
  "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
<web-app>
  <servlet>
    <servlet-name>forumServlet</servlet-name>
    <servlet-class>com.oreilly.forum.servlet.ForumServlet</servlet-class>
    <init-param>
      <param-name>jdbcDriverClassName</param-name>
      <!-- MySQL version is commented out:
      <param-value>org.gjt.mm.mysql.Driver</param-value>
      -->
      <param-value>sun.jdbc.odbc.JdbcOdbcDriver</param-value>
    </init-param>
    <init-param>
      <param-name>databaseURL</param-name>
      <!-- MySQL version is commented out:
      <param-value>jdbc:mysql://localhost:3306/forum</param-value>
      -->
      <param-value>jdbc:odbc:forum</param-value>
    </init-param>
    <init-param>
      <param-name>adapterClassName</param-name>
      <!-- Relational database version is commented out:
      <param-value>com.oreilly.forum.jdbcimpl.JdbcDataAdapter</param-value>
      -->
      <param-value>com.oreilly.forum.fakeimpl.FakeDataAdapter</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>forumServlet</servlet-name>
    <url-pattern>/main/*</url-pattern>
  </servlet-mapping>
</web-app> 

The deployment descriptor contains context initialization parameters for the data adapter layer. The default settings utilize a "fake" data adapter, allowing the discussion forum to function without creating any sort of database. Once this is up and running, you will want to create a relational database and configure the appropriate parameter values as shown in web.xml.

7.5.2. Ideas for Enhancements

A few key features were omitted to keep this chapter reasonably sized (as you can see, this is already far longer than any other chapter in the book). Some ideas for enhancements include:

  • Database connection pooling

  • Web-based administration tools

  • Authentication of users

  • The ability to search the entire archive

  • Alternate client user interfaces, such as XHTML Basic or WML

Any one of these features can be added without fundamentally changing the existing architecture. User authentication is probably the biggest change, because new database tables may be required to associate messages with users. For web-based administration tools, additional request handlers and renderers need to be written. These tools also need to be integrated with the security and authentication mechanism; otherwise, any user can run the administrative tools.

Searching is beyond the abilities of XML and XSLT and is best handled by a dedicated search engine technology. This could be as simple as embedding a few lines of HTML into each page that links to a search engine such as Google.[34] Another approach is to write custom search code that integrates more directly with the underlying database. Finally, the whole issue of supporting alternate client user interfaces will be discussed in the next chapter. In a nutshell, this will involve detecting the client browser type and selecting an appropriate XSLT stylesheet.

[34] Even though all pages are generated dynamically, many web crawlers such as Google index every page in the application.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.