Understanding XML DTDs


Overview

The Tiles framework, which supports the creation of regions within a page, provides a rich JSP templating system that extends beyond JSP's built-in include mechanism. Like the include mechanism, Tiles templates can be defined and accessed via JSP Tag Library tags. However, Tiles takes it one step further by allowing your application's configuration to be specified declaratively in an external configuration file instead of being hard-coded into JSPs. This greatly simplifies development because many changes can be made to the application without having to recompile any code.

The Tiles configuration file is XML-based, and its format is governed by a Document Type Definition (DTD) file that specifies how the configuration tags must be ordered in the file, what settings are required, and so on. Each Tiles configuration file declares its conformance to the DTD by having the following DOCTYPE definition at the top of the file:

<!DOCTYPE tiles-definitions PUBLIC   "-//Apache Software Foundation//DTD Tiles Configuration 1.3//EN"   "http://struts.apache.org/dtds/tiles-config_1_3.dtd">

When Tiles reads the configuration file, its XML parser uses the DOCTYPE definition to determine to which DTD the XML file must conform. If configured to do so, the XML parser will validate the XML file's conformance to the DTD.

Note 

An in-depth discussion of the Tiles framework is found in Chapter 7.



Struts. The Complete Reference
Struts: The Complete Reference, 2nd Edition
ISBN: 0072263865
EAN: 2147483647
Year: 2004
Pages: 165
Authors: James Holmes

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net