Documentation
Home
Live Examples (new)
Quick overview
Tutorial
Tutorial Live Examples
Download
Installation
User Guide
Javadoc

Tag Library Reference
Tiles Tags

Printer Versions
Quick Overview
Tutorial
User Guide
Overview (old)

Old Documents
Overview (old)

Prerequisite Software

Copyright : This page is largely inspired from the originalStruts installation page. For those familiar with Struts, there is nothing realy new.

In order to install and use a binary distribution, you will need to acquire and install several other software packages, as follows:

  • Java Development Kit- You must download and install a version 1.1 (or later) Java Development Kit implementation for your operating system platform. Youmusthave a Java2 version (JDK 1.2 or later) to build the Struts source distribution, and several of the custom tags in the Struts library require Java2 to execute. A good starting point for locating Java Development Kit distributions ishttp://java.sun.com/j2se.
  • Struts- You must download and install Struts , with release greater than 0.5. A compatible release of Struts is attached with examples.
  • Servlet Container- You must download and install a servlet container that is compatible with the Servlet API Specification, version 2.2 or later, and the JavaServer Pages (JSP) Specification, version 1.1 or later. One popular choice is to download Apache'sTomcat(version 3.1 or later required, version 3.2 or later recommended).
  • Servlet API Classes- In order to compile Struts itself, or applications that use Struts, you will need a servlet.jarfile containing the Servlet and JSP API classes. Most servlet containers include this JAR file. Otherwise, you can get the Servlet API classes distribution fromhere.
  • XML Parser- Struts requires the presence of an XML parser that is compatible with the Java API for XML Parsing (JAXP) specification. You can download and install the JAXPreference implementation, which is required for building the Struts source distribution. In Struts-based web applications, you may replace the reference implementation classes with any other JAXP compliant parser, such asXerces. See detailed instructions related to the parser in the instructions forbuildingandinstallingStruts, below.
Building Components Library From Source

For now, There is no tools facility to build the Components Library.

Install A Binary Distribution

First, download a binary distribution.  Then, make sure you have downloaded and installed all of theprerequisite software packages described above.

Unpack the binary distribution into a convenient directory. The distribution consists of the following contents:

  • lib/components.jar- This JAR file contains all of the Java classes included in components. It should be copied into the WEB-INF/libdirectory of your web application.
  • lib/components.tld- This is the "tag library descriptor" file that describes the custom tags in the Components library. It should be copied into the WEB-INFdirectory of your web application.
  • lib/extension.tld- This is the "extension tag library descriptor" file that describes the extension tags which are basically Struts tags, with additional useful functionalities for components. It should be copied into the WEB-INFdirectory of your web application.
  • webapps/comp-struts-portal.war- This is a "web application archive" file containing all of the documentation and examples. Start from this example. You can install this web application on any servlet container compatible with Servlet API 2.2 or later.
  • webapps/comp-struts.war- This is an example web application that uses a large percentage of Struts features, revisited with Components. You can install this web application on any servlet container compatible with the Servlet 2.2 (or later) and JSP 1.1 (or later) specifications.
  • webapps/comp-struts-instances.war- This is an example web application that uses a large percentage of Struts features, revisited with Components and instances. You can install this web application on any servlet container compatible with the Servlet 2.2 (or later) and JSP 1.1 (or later) specifications.

To use Components in your own application, you will need to follow these steps:

  • Copy the file lib/components.jarfrom the Struts distribution into the WEB-INF/libdirectory of your web application.
  • Copy lib/components.tld and lib/extensions.tldfrom the Components distribution into the WEB-INFdirectory of your web application.
  • Modify the WEB-INF/web.xmlfile for your web application to include a <servlet>element to define the controller servlet, and a <servlet-mapping>element to establish which request URIs are mapped to this servlet. Use the WEB-INF/web.xmlfile from the Struts example application for a detailed example of the required syntax.
  • If you want to use instances, use the modified version of ActionServlet , by adding following lines in the WEB-INF/web.xmlfile :
    <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>org.apache.struts.tiles.ActionComponentServlet</servlet-class
        <init-param>
          <param-name>instances-config</param-name>
          <param-value>/WEB-INF/componentInstances.xml</param-value>
        </init-param>
    ...
     
  • If you use instances , but don't want to use modified servlet, you must initialize instances list, either in your own servlet (see ComponentActionServlet.java) or at begining of page (see tags).
  • Modify the WEB-INF/web.xmlfile of your web application to include the following tag library declarations:
            <taglib>
              <taglib-uri>/WEB-INF/components.tld</taglib-uri>
              <taglib-location>/WEB-INF/components.tld</taglib-location>
            </taglib>
  • Create a file WEB-INF/struts-config.xmlthat defines the action mappings for your specific application. You can use the struts-config.xmlfile from the portal example application for a detailed example of the required syntax.
  • At the top of each JSP page that will use the Component custom tags, add line(s) declaring the Component custom tag librariesused onthis particular page, like this:< PRE> <@ taglib uri="/WEB-INF/components.tld" prefix="comp" %>
    
    							
  • When compiling the Java classes that comprise your application, be sure to include the components.jarfile (copied earlier) on the CLASSPATH that is submitted to the compiler.

Copyright © 2000-2002, Apache Software Foundation
and Cedric Dumoulin