Child pages
  • Struts 1 Plugin

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Warning
titleWarning

The Struts 1 plugin is currently only intended to allow you to run Strust 1 actions inside a Struts 2 application. It DOES NOT allow you to continue to use the Struts 1 tag libraries in your JSPs. Your JSPs must be converted to use the Struts 2 tag library.

There is a JIRA ticket open for enhancing this plugin to allow a more seamless transition from Struts 1 to Struts 2 by supporting continued use of the Struts 1 tag libraries in JSPs, however, there is not a scheduled time frame for that functionality to be made available. (Patches are welcomed!)

...

In the most simple case, where you have a Struts 1 Action that you want to use in Struts 2, configure a Struts 2 action using the wrapper:

Code Block
langxml
titleSimple Struts 1 configuration
langxml
<action name="myAction" class="org.apache.struts2.s1.Struts1Action">
  <param name="className">com.mycompany.myapp.MyAction</param>
  <result>myAction.jsp</result>
</action>

Most likely, you will have an ActionForm that your Struts 1 Action expects. To use an ActionForm, the setup is a little more complicated because you'll need an interceptor that manages the creation and scope (to support request and session scoping like Struts 1) of the ActionForm.

Code Block
langxml
titleStruts 1 Action with a session-scoped ActionForm
langxml

<action name="myFormAction" class="org.apache.struts2.s1.Struts1Action">
  <param name="className">com.mycompany.myapp.MyAction</param>

  <interceptor-ref name="scopedModelDriven">
    <param name="className">com.mycompany.myapp.MyForm</param>
    <param name="name">gangsterForm</param>
    <param name="scope">session</param>
  </interceptor-ref>
  <interceptor-ref name="struts1-default"/>

  <result>myAction.jsp</result>
</action>

...