You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Name

Spring MVC Plugin

Author

Tom Schneider

Homepage

http://code.google.com/p/struts2springmvc/

Version

1.0

Compatibility

Struts 2.0.2+

State

Beta

License

Open Source (ASL2)

Download

http://code.google.com/p/struts2springmvc/downloads/list

Overview

This plugin allows Spring MVC controllers and interceptors to be executed in Struts2. This plugin is useful for Spring MVC developers want to migrate to struts, but do not want to rewrite their Spring MVC controllers and interceptors.

Features

  • Includes a struts2 action that can execute Spring MVC controllers.
  • Includes a struts2 interceptor that can execute Spring MVC interceptors.
  • Allows the Spring MVC view to be accessed via the OGNL stack.

Getting Started

Installation

This plugin can be installed by copying the plugin jar into your application's /WEB-INF/lib directory. No other files need to be copied or created.

Configure Spring Controller in Spring

The first step in using the Spring MVC plugin is to configure your Spring MVC controller in Spring:

	<bean id="ratingController" class="example.RatingController"></bean>

Configure the controller in Struts2

Now the controller needs to be configured in Struts2:

<action name="CalcRate" class="com.googlecode.struts2springmvc.SpringMVCControllerAction">
	<param name="controllerName">ratingController</param>
	<result name="success">/example/displayrate.jsp</result>
</action>

The controllerName parameter is the name of the controller in the Spring configuration. The ModelAndView viewName is mapped to the Struts2 result. The model Map is exposed as a model property on the value stack and can be accessed as follows:

<s:property value="model['rate']"/>

Version History

Version

Date

Author

Notes

1.0.0-beta

January 13, 2007

Tom Schneider

Initial release

  • No labels