XML technologies / XSLT / Java and XSLT / Discussion forum / The final tasks
(Excerpt from “Java und XSLT” by Eric M. Burke)
That concludes the example. Since the application has grown quite large, download the code from the book’s website rather than typing it manually. Remember that additional classes are listed in the JAXP API reference.
Application
Installing the example also requires a deployment descriptor and a WAR file. The deployment descriptor web.xml appears in the next example.
Example: 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 ist auskommentiert: <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 ist auskommentiert <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>
<!-- Datenbank-Version ist auskommentiert: <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 descriptor contains context initialization parameters for the data abstraction layer. Defaults use the mock database adapter, so the forum works without a database. Once it runs, install a relational database and configure the parameter values in web.xml accordingly.
Suggested improvements
Important features were omitted to keep this chapter manageable; it is already much longer than the others. Some suggested improvements are:
Integrating a database connection pool
Web-based administration tools
User authentication
Searching the entire archive
Alternative user interfaces, such as XHTML Basic or WML
Each feature can be added without major architectural changes. Authentication is the largest hurdle, requiring new database tables to associate messages with users. A web administration tool requires additional request handlers and renderers, plus security and authentication to prevent every user from administering the system.
Searching exceeds XML and XSLT’s capabilities and is best implemented with dedicated search technology. The simplest option is to add a few HTML lines linking each page to a search engine such as Google. Despite dynamic generation, many engines, including Google, index every application page. You could also write search algorithms accessing the database directly. Later chapters discuss alternative interfaces, including detecting the client browser type and choosing a suitable XSLT stylesheet.
Copyright © 2002 O'Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from “Java und XSLT” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de