Plugins You can find out about all the publicly available Grails plugins.

Provides integration between Grails and the Struts 1 framework

  • Tags: other frameworks
  • Latest: 1.3.11
  • Last Updated: 13 October 2012
  • Grails version: 2.0 > *
0 vote
compile "org.grails.plugins:struts1:1.3.11"

 Documentation  Source  Issues


A plug-in that makes Struts 1 ( the default controllfer/view rendering framework for Grails. Struts is an older first generation framework and this plug-in facilitates migration away from Struts to a modern stack like Grails. If you want to use this with Grails 1.3.x, you must use v1.3.10 of this plugin as Grails 2 introduced breaking changes.


Struts 1 Plug-in for Grails

Grails is a full stack framework that provides everything from the build system to the persistence layer. Struts 1 is a first generation Java web framework that is still very popular, but it only solves the controller/view layer.

current plugin source is at:

This plug-in allows you to use Struts 1 as a the controller/view layer for Grails and also provides a migration path to Grails from Struts 1.

For Grails 1.0 you will need version of the plugin, whilst for Grails 1.1 and above you will need version or above of the plugin

Getting Started

Once you have created a Grails application, you need to install the plug-in. The plug-in is hosted in the Grails central repository and can be installed with:

grails install-plugin struts1

Alternatively you can download the plugin as a zip file from here:

And then run

grails install-plugin /path/to/file/

Either way it will set up struts with the most common servlet mapping of .do. The next thing you need to do is change the way Grails deals with file extensions otherwise Grails will swallow the .do mapping. To do this set the following property in grails-app/conf/Config.groovy:

grails.mime.file.extensions = false

Now you have setup Struts 1 inside Grails and there is a struts-config.xml and validation.xml within /web-app/WEB-INF. Now when you run

grails run-app

Struts will load inside Grails

Migrating an Existing Struts application

To migrate an existing Struts 1 application you can simply:

  1. Copy your struts-config.xml and validation.xml into web-app/WEB-INF over writing the existing ones if necessary
  2. Copy Java sources into src/java
  3. Copy all dependant JAR files into the lib directory

Forwarding to a GSP view from Struts

You'll notice that by default the struts-config.xml setup by Grails has the following mapping:


Notice how we're able to map the URI / to a GSP page.

Mapping a Struts action to a Grails controller

If you prefer to write your controller logic in Grails controller you can do so and use the ControllerActionProxy class to map to it. For example given the following Grails controller:

class TestController {
	def foo = {
		println "EXECUTING FOO"

To map to this controller with ControllerActionProxy simply add this to struts-config.xml:


Now when you go to /test/ in the browser the {{ControllerActionProxy}} will automatically map onto the Grails controller.

Even better Grails' view mapping conventions will be honoured and in this case the view grails-app/views/test/foo.gsp will be rendered. The Struts 1 plug-in also adds two new implicit properties to the Grails controllers:

  • actionMapping - An instance of the Struts ActionMapping class
  • actionForm - An instance of the Struts ActionForm class if one is configured for the Action


  • Be sure to pick Plugin, not 1.3.8
    • rvanderwerf
  • If your struts code uses file uploads, see jira for the code to override multipartResolver bean with one that is struts aware.