Upgrading a Struts 1 Portlet

Upgrading Portlets

Step 6 of 6

Struts is a stable, widely adopted framework that implements the Model View Controller (MVC) design pattern. If you have a Struts portlet for previous versions of Liferay Portal, you can upgrade it to Liferay DXP 7.2.

Upgrading Struts portlets to Liferay DXP 7.2 is easier than you might think. Liferay DXP lets you continue working with Struts portlets as Java EE web applications.

This tutorial demonstrates how to upgrade a portlet that uses the Struts 1 Framework.

Here’s a sample Struts portlet’s folder structure with file/folder descriptions:

  • sample-struts-portlet
    • docroot/
      • html/portlet/sample_struts_portlet/ → JSPs
      • WEB-INF/
        • lib/ → Required third-party libraries unavailable in the Liferay DXP system
        • src/
          • com/liferay/samplestruts/model/ → Model classes
          • com/liferay/samplestruts/servlet/ → Test servlet and servlet context listener
          • com/liferay/samplestruts/struts/
            • action/Action classes that return View pages to the client
            • form/ActionForm classes for model interaction
            • render/Action classes that present additional pages and handle input
            • SampleException.java → Exception class
          • content/test/ → Resource bundles
          • META-INF/ → Javadoc
        • tld/ → Tag library definitions
        • liferay-display.xml → Sets the application category
        • liferay-plugin-package.properties → Sets metadata and portal dependencies
        • liferay-portlet.xml → Maps descriptive role names to roles
        • liferay-releng.properties → (internal) Release properties
        • portlet.xml → Defines the portlet and its initialization parameters and security roles
        • struts-config.xml → Struts configuration
        • tiles-defs.xml → Struts Tile definitions
        • validation.xml → Defines form inputs for validation
        • validation-rules.xml → Struts validation rules
        • web.xml → Web application descriptor
    • build.xml → Apache Ant build file

Upgrading a Struts 1 portlet involves these steps:

  1. Adapt the portlet to Liferay DXP 7.2’s API using the Liferay Upgrade Planner. When running the planner’s Fix Upgrade Problems step, many of the existing issues are autocorrected. For remaining issues, the planner identifies code affected by the new API and ways to adapt it.

  2. Resolve its dependencies

You’ve resolved the Sample Struts portlet’s dependencies. It’s ready to deploy.

On deploying a Struts portlet Web Application aRchive (WAR), Liferay DXP’s Web Application Bundle (WAB) Generator creates an OSGi module (bundle) for the portlet and installs it to Liferay’s OSGi framework. The server prints messages indicating the following portlet status:

  • WAR processing
  • WAB startup
  • Availability to users

The Struts portlet is now available on your Liferay DXP instance. The Struts portlet behaves just as it did on previous versions on your Liferay DXP 7.2 site.

Congratulations on upgrading your Struts portlet to Liferay DXP 7.2!

« Upgrading a Spring Portlet MVC PortletUpgrading Web Plugins »
¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0