Struts Portlet Framework
Learn how to write Struts applications that can be deployed in WebSphere Portal. Know special considerations when developing such applications and additional concepts, such as portlet modes, multiple device support, and portlet communications that might need to be addressed by the Struts application.Struts is a popular open source project for implementing Web applications using a Model-View-Controller design pattern. Struts has an active development community and continues to evolve. The user community is equally active and many Web applications have been implemented using Struts. The Struts framework can be used to effectively design the Web application. The framework supports both large or small development teams as well as organizations that need to split the development work between specialists (for example, between user interface designers and programmers). The reasone that Struts has became popular for the servlet environment apply for portlets as well. This document introduces the Struts Portlet Framework, which adds support for writing Struts applications that can be deployed in WebSphere Portal.
Developers that have worked with Struts in the servlet environment should adapt easily to the Struts Portlet Framework. The packaging of a Struts portlet application is very similar to a Struts application in the servlet environment. However, WebSphere Portal also introduces additional concepts, such as portlet modes, multiple device support, and portlet communication,that might need to be addressed by the Struts application. This document provides information about special considerations when developing Struts applications for the portlet environment.
For more detailed information, we can find numerous sources available about Struts. The Struts Web site offers resources for developers, including a User Guide, Javadoc information, and the source code. There are also several excellent books on Struto that are referenced from the Struts Web Site. These references describe in detail the aspects of designing and implementing a Web application using Struts. For more information about Struts, see the link to the Struts Application Framework.
The Struts Portlet Framework ships several example WAR files, including source codes that demonstrate how to implement a Struts application in WebSphere Portal and also how to exploit portal features, such as portlet modes and device support. Throughout this documentation, source code from SPFLegacyMailReader.war and SPFStandardMailer.war is used to demonstrate the changes necessary to enable a Struts Web application to be deployed and run as a portlet. SPFLegacyMailReader.war is available on the WebSphere Portal Catalog.
The following subtopics describe the development of Struts applications in the portal environment.
- Changes to Struts application code
Learn about the main differences between a servlet-based Struts application and a Struts application created for the portal environment.- Changes to Struts JSPs
The JSPs for Struts applications in the portal environment have to be modified to adapt to the way the portal server expects portlet URIs to be created. There are some changes to the tag library for HTML markup and additional tag libraries have been added to support cHTML and WML markup.- Changes to configuration files
Struts Portlet Framework specific init parameters have been added that allows us to customize the Struts application for the portal environment. The portlet and web deployment descriptorss require configurations specific to the Struts Portlet Framework. In addition, changes to the Struts configuration file must be made to specify a portal specific request processor as the controller.- Support multiple Struts applications
Learn how web applications that allow packaging more than one Struts-based portlet in a single application can be created either using Struts modules or a namescoped servlet context.- Create link tags in Struts
Get an overview of how to write tags to create links in a JSP in both a servlet and a portlet in Struts framework.- Formatting XML documents with XSLT
Learn how a Struts application supports applying a style sheet to XML data.- Static content in Struts
Portlet JSPs can link to the static content within the portlet’s WAR directory structure using the services of the portlet container to create portlet URIs from which the content can be referenced.- Migrate existing Struts applications
Get an overview of how the existing Struts applications can be migrated using the Struts Portlet Framework so that these applications can be deployed in IBM WebSphere Portal.
Parent: Develop portlets
Related:
Portlet communication
IBM Portlet API
Understand the basics
Related: