Integrating Struts Applications

You can integrate, or import, a Struts 1.1 application into an enterprise application in WebLogic Workshop. Once in WebLogic Workshop, you can quickly and easily give the Struts application a portal user interface, add personalization and campaign functionality to it, and take advantage of WebLogic Portal's content and user management services.

This topic contains the following sections:

Integrating a Struts Application into a Portal

Best Practices and Development Issues

Struts and Page Flows

Integrating a Struts Application into a Portal

  1. Create a portal application and portal Web project in which to add the Struts application. See Creating a Portal Application and Portal Web Project. Struts support is added automatically.
  2. In order for URLs to resolve correctly, Java Page Flow support must be enabled in the portal Web project's WEB-INF/netuix-config.xml file, as shown in the following example. Notice the <enable> element is set to true.

    <!-- Enable or disable Pageflow support -->
    <pageflow>
        <enable>true</enable>
    </pageflow>

    If this block is not present in netuix-config.xml, do not add it. Without the block, the setting defaults to true.

  3. Add the Struts application to the portal Web project.
    1. Copy any JSP, HTML, or image files into the portal Web project following the standard Struts module directory structure (the module path is the directory path relative to the Web application root).
    2. Copy any supporting Java source used by the Struts application into the project's WEB-INF/src.
    3. Copy any necessary custom JARs for the Struts application into WEB-INF/lib.
    4. Copy the Struts application's struts-config.xml or module configuration file into WEB-INF, but rename it struts-auto-config-<module-path>.xml, where <module-path> is the module path to the Struts application relative to the Web application root, with all instances of '/' or '\' changed to '-'.

      For example, if the module path is /struts/my/module, struts-config.xml should be renamed to struts-auto-config-struts-my-module.xml. Naming the module configuration file in this manner enables the PageFlowctionServlet used as the Action Servlet to automatically register the module without explicitly registering it with an init-param in web.xml. If you don't want to take advantage of this functionality, you can rename struts-config.xml arbitrarily, but you must manually register the module in web.xml as usual for a Struts 1.1 module.
    5. In the module configuration file, add the following line to configure the RequestProcessor that is required for portal integration:

      <controller processorClass="com.bea.struts.adapter.action.AdapterRequestProcessor"/>

      (unless the Struts application requires a custom RequestProcessor).
  4. Create a portlet that contains a StrutsContent control that specifies the module and the default action for the Struts application. See Building Portlets.
  5. Add the new portlet to the portal using the WebLogic Workshop Portal Designer. See Adding a Portlet to a Portal.

Best Practices and Development Issues

Use the following guidelines for integrating Struts applications in portals:

Struts and Page Flows

WebLogic Workshop provides interchangeable support for Struts modules and Page Flow controller classes working together in the same Web project. See Interoperating With Struts and Page Flows.

Related Topics

Advantages of Using Page Flows

Building Portlets