Java 8

From this version of Struts, the framework requires Java 8 at least to run.

Servlet API 3.1

Struts 6.0.0 requires a servlet container which supports Servlet API 3.1 at least, it won't work with older versions.

Dependencies

Update Struts dependencies to 6.x.x.

Remove the following plugin dependencies because they were dropped and aren't supported anymore:

  • sitegraph plugin

Support for Velocity has been moved into a dedicated plugin, also Velocity based tags were moved into the new plugin, see WW-5049 - Getting issue details... STATUS for more details.

To still use the Velocity plugin in your application you must include the plugin and its JARs plus use a proper parent package in your struts.xml  like this:

<package name="mystrutsapp" extends="json-default, velocity-default">
  ...
</package>


DTD

Please use a proper DTD header in struts.xml as demonstrated below:

<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
        "https://struts.apache.org/dtds/struts-6.0.dtd">

Class changes

com.opensymphony.xwork2.config.providers.XmlConfigurationProvider became abstract, please 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

All Xwork constans had been already deprecated, with this version all of them have been removed and Struts constants have been used instead. See tickets WW-4792 - Getting issue details... STATUS and WW-5000 - Getting issue details... STATUS with the linked PRs for the exact changes. Below is a list of removed constants and Struts substitutes:

Old constantNew constant
collectionConverter struts.converter.collection
dateConverterstruts.converter.date
numberConverterstruts.converter.number
stringConverterstruts.converter.string
arrayConverterstruts.converter.array
devModestruts.devMode
logMissingPropertiesstruts.ognl.logMissingProperties
enableOGNLExpressionCachestruts.ognl.enableExpressionCache
enableOGNLEvalExpressionstruts.ognl.enableEvalExpression
reloadXmlConfigurationstruts.configuration.xml.reload
allowStaticMethodAccessstruts.ognl.allowStaticMethodAccess
xwork.loggerFactory<not used any more>
ognlExcludedClassesstruts.excludedClasses
ognlExcludedPackageNamePatternsstruts.excludedPackageNamePatterns
ognlExcludedPackageNamesstruts.excludedPackageNames
additionalExcludedPatternsstruts.additional.excludedPatterns
additionalAcceptedPatternsstruts.additional.acceptedPatterns
overrideExcludedPatternsstruts.override.excludedPatterns
overrideAcceptedPatternsstruts.override.acceptedPatterns
struts.xwork.chaining.copyErrorsstruts.chaining.copyErrors
struts.xwork.chaining.copyFieldErrorsstruts.chaining.copyFieldErrors
struts.xwork.chaining.copyMessagesstruts.chaining.copyMessages
xwork.autoGrowCollectionLimitstruts.ognl.autoGrowthCollectionLimit
objectFactory.classloaderstruts.objectFactory.classloader

New constants

Constant nameDescription
struts.i18n.search.defaultbundles.firstAllows search in default bundles first, read more in the docs
struts.ui.escapeHtmlBodyEnables escaping body of a tag, read more in the docs

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:

<s:a href="%{...}">
  <img src="<s:url value='/images/icon_waste_sml.png'/>"/>
</s:a>

the inner tag can be automatically escaped (if needed), set "escapeHtmlBody" attribute to "true" as below:

<s:a href="%{...}" escapeHtmlBody="true">
  <img src="<s:url value='/images/icon_waste_sml.png'/>"/>
</s:a>

There is a global flag struts.ui.escapeHtmlBody which controls this behaviour for all the tags. Tag's attribute takes precedence over the global flag. It's related to WW-5022 - Getting issue details... STATUS and WW-4972 - Getting issue details... STATUS .

The date tag

The <s:date/>  tag has been adjusted to support a new Java 8 Date/Time API, which means it uses DateTimeFormatter instead of SimpleDateFormat. Yet there is a slight change in patterns supported by both classes, which means your current formatting patterns can stop working after migrating to Struts 6.x and default format will be used instead. You can find more details in WW-5016 - Getting issue details... STATUS .

Deprecated interfaces

A set of action related interfaces have been marked as deprecated. These interfaces have a new proper versions in another package, please start using the new versions as the depretacted interfaces will be removed with the next major release.

DeprecatedNew version
org.apache.struts2.interceptor.ApplicationAwareorg.apache.struts2.action.ApplicationAware
org.apache.struts2.interceptor.CookiesAwareorg.apache.struts2.action.CookiesAware
org.apache.struts2.interceptor.HttpParametersAwareorg.apache.struts2.action.ParametersAware
org.apache.struts2.interceptor.ParameterAwareorg.apache.struts2.action.ParametersAware
org.apache.struts2.interceptor.PrincipalAwareorg.apache.struts2.action.PrincipalAware
org.apache.struts2.interceptor.RequestAwareorg.apache.struts2.action.ServletRequestAware
org.apache.struts2.interceptor.ServletRequestAwareorg.apache.struts2.action.ServletRequestAware
org.apache.struts2.interceptor.ServletResponseAwareorg.apache.struts2.action.ServletResponseAware
org.apache.struts2.interceptor.SessionAwareorg.apache.struts2.action.SessionAware
org.apache.struts2.util.ServletContextAwareorg.apache.struts2.action.ServletContextAware

See WW-4963 - Getting issue details... STATUS for more details.

Javatemplate Checkbox tag

Javatemplate Checkbox tag implementation had been missing support for submitUnchecked attribute. This has been fixed yet it 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, see WW-5168 - Getting issue details... STATUS for more details.

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.

Temp/Work directory of ApplicationServer/ServletContainer

Users reported it was necessary for them to remove temp/work directory of their ApplicationServer/ServletContainer. Likely to force server to recompile JSPs.