Skip to content

Struts 2.5 to 6.0.0 migration #1

@timtebeek

Description

@timtebeek

What problem are you trying to solve?

Recipe to migrate to Struts 6.x

  • Upgrade to Java 8
  • Servlet API 3.1
  • Update Struts dependencies to 6.x.x.
    • Remove sitegraph plugin
    • Add Velocity plugin if needed
  • Use a proper DTD header in struts.xml
  • Class changes
    • com.opensymphony.xwork2.config.providers.XmlConfigurationProvider became abstract,
      use org.apache.struts2.config.StrutsXmlConfigurationProvider instead
    • com.opensymphony.xwork2.conversion.TypeConversionException was replaced by org.apache.struts2.conversion.TypeConversionException
    • com.opensymphony.xwork2.XWorkException was replaced by org.apache.struts2.StrutsException
  • XWork constants; see list of removed constants and Struts substitutes
  • New constants struts.i18n.search.defaultbundles.first and struts.ui.escapeHtmlBody
  • Tag escape behaviour
    • After migrating to the latest Freemarker (which enables auto-escaping by default) you should stop using ?html in your custom tags and freemarker based pages.
    • Also when embedding a tag in <s:a>, <s:submit> and <s:component> tags like in the example below:
  • The <s:date/> tag has been adjusted to support a new Java 8 Date/Time API
  • Deprecated interfaces
    • These interfaces have a new proper versions in another package, please start using the new versions as the deprecated interfaces will be removed with the next major release
  • Javatemplate Checkbox tag
    • can introduce a NullPointerException when you will use Boolean or String to hold an unchecked value as submittedUnchecked is set to false by default, which means the unchecked value won't be sent and stored in the action
  • Static methods access
    • It won't be possible to access static methods using OGNL expression, eg. @com.app.Util@makeCode() won't work anymore. If you are still using this approach you must wrap access to static methods with action instance methods or use static field access instead.

Any additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Recipes Wanted

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions