Quick overview (new)

Tag Library Reference
Components Tags
Extension Tags

Printer Versions
Quick Overview (new)
Overview (old)

Old Documents
Overview (old)


Components have been renamed to Tiles. Please use the new Tiles site !

This page is left as an archive.

Welcome to the Components website. This "portal" page is an example of what can be done with Components. It is made by assembling Components. It is an example of what you can do with Components.
Components can be seen as extended templates.
If you want to know more, take a glance to the quick overview examples, or start by the tutorial.

Components Library
Components Concept :
  • A component extends the Template concept by adding new features.
  • A component is a JSP page that can be inserted in any JSP pages, and that can take "parameters" (String, URLs, List, ...).
    • Inside the Component / JSP page, you can use parameter value : write it or use it to include another Component / JSP page
  • If well defined, components can be reused across pages.
  • Can propose "library" of reusable components.
  • With Components, you can easilly build portal pages 
    •  Define Components that will make your portal
    • Assemble Components in a list fashion (see the Components Documentation as example)
  • With Components, you can easilly build menu : just pass a lists of items to show, and list of links to a Component that will do the job
  • Define your own Components taking parameters (simple or list), and doing what you want
Template mechanism :
  • Compatible with Struts JSP Templates
    • You can use Components in place of Templates
  • A template is a page made of components ...
  • Templates can be defined in a centralized file (see Components Definitions)
Component / Template Definitions :
  • You fix some parameters of your component (like URLs of header and footer), and you got a definition .
  • Definitions can be described in a centralized XML file
  • Definition can be created in a Struts action, and parameters can be set dynamically.
  • A definition can also be described in JSP page.
  • A definition can inherit from another definition . This allows to define a main definition, with fixed header, title, body, footer and menu, and let other definitions inherit from it, just overiding requested parameters (usually body and title).
  • A "forward" in struts-config file can specify a definition name as target.

Internationalization (I18n)

  • It is possible to have multiple localized copies of the same component, and load appropriate one according to the Locale.

Future Features
Dynamic Portal Example
Portal page is build according to a user profile, or whatever you want.

To Do
Components Configuration File
  • Add the ability to have attribute value in tag body. This is already the case in JSP pages, but not in Configuration file.
  • Add role attribute to tags in instance configuration file.
  • Be able to reload instance descriptions without restarting Tomcat


Components have been renamed to Tiles. Please use the new Tiles site !

Last (please use Tiles now) development version of Component Library can be downloaded from following web sites (choose one site) :
Latest build : 2001 07 04 (with struts2001 06 27 - 1.1dev)
WARNING : Deprecated tags from previous builds have been removed in the new build. Check the backward compatibility table to help update your sites.

Components and
JSP Templates

  While I have proposed the "Components", David Geary has proposed the "JSP Templates".

  In fact, JSP Templates provide nearly the same solution, with nearly the same implementation. But, Components go
one step beyond and extend the concept of "templates" to the concept of "components".
  A component is a JSP page that can be inserted in any JSP pages (like templates !), and that can takes "parameters" (URLs or 'direct' string in templates). Furthermore, you can create 'definitions' of components (or templates) in a XML description file, allowing a central point for modifications, inheritance of existing definition, parameters overload, ...
  Since the JSP Templates proposal, I have try to merge both.

Now, Components are compatible with JSP Templates
Futhermore, parts of Components features will be integrated in Struts
To test JSP Templates compatibility, try this :
  • take original JSP Template example (struts-template),
  • put "components.jar" in WEB-INF/lib,
  • put "components.tld" in WEB_INF/tlds,
  • in WEB-INF/web.xml change the taglib uri location to :  
  • try the example. It now use the component library.
  • Have a look to comps-template, it is the (old) template example, using instances declared in a centralized file



Integration with Struts

As "Struts committer", I will progressively integrate parts of Components proposal in the Struts project. This will start soon with Struts 1.1.

For now, this library is a proposal. I have tried to minimize modifications in Struts code.
Rather than to provide modified copy of Struts, I prefer to subclass classes needing modifications. Tags needing modification are also subclassed, and declared in a separate tld file. Following is a list of actual modifications :

Action Servlet
  • Add a "processForward" method.
  • Purpose : be able to subclass servlet, and override the forward mechanism.
  • Needed if you want to forward to a definition in struts-config.xml.
text tag
  • Not mandatory, can be omitted if not used
  • Add a "prefix" attribute.
  • Purpose : be able to add a prefix to the name of generated input tag. This modification is not mandatory. It is only useful in some examples.

Give Your Feedback !

This library is a proposal. Feel free to give your feedback on it !
If you have any idea to improve it, let me know !
Contact me at :

12 jul. 2001
  • Check componentContext before setting it in pageContext in InsertTag (Silverstream issue ?)
04 jul. 2001
  • Add flush attribute to get
  • Update tutorial
  • Add a DTD for configuration file. However, DTD is not used (yet) for validation.
02 jul. 2001
  • Tested successfully on Tomcat-3.2.1, Tomcat-4.0b5, Orion-1.4.5, Resin-2.0.0
  • Correct the release() bug preventing framework to run on Resin-2.0.0
    • Remove calls to release() in doEndTag(), call to releaseInternal() instead.
17 jun. 2001
  • Remove backward compatibility with deprecated tags. Update webapps accordingly
  • Release multi-channels example.
20 may. 2001
  • Change definition factory implementation.  This simplify design and usage of others implementations. A 'multi-channel' implementation is in study.
  • Allow to insert an 'action URL' as well as a 'definition' or a 'jsp'. This implies a check in ActionServlet just before doing effective forward or include.
29 apr. 2001Stable version
  • Role attribute is taken into account.
  • PutList accept nested putList.
  • Clearly separate definition factory.
    • Possibility to implement others definition factory
    • Can provide definition factory class name as servlet attribute
  • Change nested tags implementation (PutTag, PutListTag, AddTag, InsertTag, DefinitionTag).
19 apr. 2001
  • Correct a bug preventing Components to run on Orion 1.4.5. Call release() at the end of insert tag.
08 apr. 2001
  • Add attribute 'ignore' to tags <get> <insert>.
  • Add tag <getAsString> to replace <getAttribute>
  • Change tests suite in comps-doc
02 apr. 2001
  • Use word "definition" instead of "instance". Concretely, a lot of class names and tag names change. Have replaced a lot of word "instance" by "definition. Old tags still exist for backward compatibility.
  • Can define a "definition" in XML file, in an Action, or by using tag <definition>
14 feb. 2001
  • Added role attribute in tags. Components are again fully compatible with JSP Templates.
07 feb. 2001
  • Modification of '' to be compliant with latest Struts servlet implementation. Import the right html.Constant class.
11 jan. 2001
  • Modification of '' to be compliant with new Struts servlet implementation. New classes are not compatible with Struts prior to 010108
  • Redesign of classes related to Instances.
  • Can now switch off/on debug output from web.xml
03 jan. 2001
  • Tested on Weblogic 6.0. (Have modify ComponentMapFactory to enable serialization).
  • Now examples use struts-config.xml (instead of old action.xml)
more ...

Copyright © 2000, Apache Software Foundation
and S1 Corporation