Sun Java System Portal Server 7 Configuration Guide

Preparing the Struts Application

This section contains the following:

Introduction

The extended struts framework shipped with Portal Server is an extension of Struts version 1.2.4. This requires that you must download Standard Struts binary, version 1.2.4, from the struts archive page, and the application must be tested as a standalone application, using standard struts.jar file. This is to ensure that you have the proper version of all the supporting JARs required by the struts framework.

Install Portal Server 7 for extended struts framework (struts.jar file) and supporting components (strutssupport.jar, portlet.jar) required to deploy Struts application as JSR168 portlet.

Modify Struts Application

To deploy any struts application as a portlet, the struts application is required to follow some of the following rules:

  1. The Struts application must abide by the restrictions applicable to any application running inside the Portal Server. For example, the request parameters in the struts application can not use keywords reserved by the portal server. The list of reserved words include "action", "provider", "targetprovider", "containerName", "last", "page", "error", "container", "selected", "editChannelName", "targetPortletChannel", and "currentChannelMode".

  2. All the forms and links must be created using struts tag library. Struts' tag library provide <html:form> and <html:link> for this purpose.

  3. JSP and HTML must not have HTML title, body, frame and base tags. This is as per the PLT.B section of portlet specification. JSP must not use forward and/or redirect.

Obtain Portlet Objects in Struts Application

It is possible for struts application to get hold of portlet objects like ActionRequest and ActionResponse. This may be required, for example, to implement EDIT functionality. However, if portlet objects are not used properly, the use of portlet objects in struts application may make it portal dependent and result in the struts application unusable as a standalone application.

The struts Action class can obtain javax.portlet.ActionRequest and javax.portlet.ActionResponse objects using the following calls:

ActionRequest aReq = (ActionRequest) request.getAttribute("javax.portlet.request");
ActionResponse aRes = (ActionResponse) request.getAttribute("javax.portlet.response");

The above two statements return javax.portlet.RenderRequest and javax.portlet.RenderResponse respectively, when called from a JSP page.

Session Information

If any struts application, deployed as a portlet, is invalidating the session using session.invalidate(), the session obtained by the struts-portlet bridge becomes the invalid one. Because of this, the bridge is unable to store rendering related information. In application server, struts application, deployed as a portlet, must not use session.invalidate() as the same session is used by struts portlet bridge.