WebSphere Portal
IBM Struts Portlet Framework


Readme for the SPFLegacyBlank sample

Introduction

The SPFLegacyBlank sample is analogous to the blank sample that is shipped by Apache Struts. The purpose of this sample is to show how to package a Struts application using the Struts Portlet Framework. This sample is the suggested starting point for obtaining the files necessary for building a Struts application to be deployed as a portlet. The packaging is similar to what Apache Struts ships, with the addition of several JAR files, some additional TLD files, some modified TLD files, and the org.apache.commons.logging.LogFactory file. The Apache Struts JARs are shipped unchanged from the Apache Struts blank portlet. The sample can be installed on WebSphere Portal Server and placed on a page. The portlet displays some text and the user cannot interact with the application. Other Struts Portlet Framework samples demonstrate different aspects of creating a Struts application for portal.

Sample details

The sample is useful to obtain the minimum set of files to create a Struts portlet application.

Code snippets

The interesting code snippet is the configuration of the controller. A servlet-based Struts application uses the ActionServlet as the controller. The portlet version instead uses a portlet as the controller. The following snippet shows the servlet class as specified in the web deployment descriptor.

  <servlet-class>com.ibm.wps.portlets.struts.WpsStrutsPortlet</servlet-class>

The servlet mapping for a Struts action is specified as an init parameter in the portlet.xml.

  <init-param>
    <name>struts-servlet-mapping</name>
    <value>*.do</value>
  </init-param>

Summary

The SPFLegacyBlank.war file is the starting point for building Struts-based web applications for the legacy container. The JARs, TLDs, and org.apache.commons.logging.LogFactory file from this WAR file should be used when creating Struts portlet applications for the legacy container.