aspose file tools*
The moose likes Spring and the fly likes Spring 3 MVC: Controller/Action/Parameters convention? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring 3 MVC: Controller/Action/Parameters convention?" Watch "Spring 3 MVC: Controller/Action/Parameters convention?" New topic
Author

Spring 3 MVC: Controller/Action/Parameters convention?

Jason Ross
Greenhorn

Joined: Mar 12, 2009
Posts: 6
Hi,

I'm new to Spring MVC, and the Spring FW in general. My previous experience is with PHP (Zend FW) and C#/ASP.NET MVC.

I'm used to having this URL mapping convention supported in all of frameworks I've worked in:

http://www.domain.com/myController/action/[optional parameters]

The framework would then look for a class named "MyControllerController," and a method in that controller named "Action" and execute it. For example:



I've seen some examples of controllers and read the Spring documentation. It looks like that convention is not supported in Spring MVC. Am I correct? You have to explicitly declare the mapping in either a bean config file or use a @RequestMapping annotation?
kunalkumar somani
Greenhorn

Joined: Jul 13, 2011
Posts: 7

Hi Jason,

Yes, You are right.

Spring MVC framework is designed around a DispatcherServlet with configurable handler mappings, view resolution ant many things. The default handler is based on the @Controller and @RequestMapping annotations if you are using spring 3.0. In older version of spring you need to declare the bean in configuration file for request mapping.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring 3 MVC: Controller/Action/Parameters convention?