• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring 3 MVC: Controller/Action/Parameters convention?

 
Jason Ross
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
Eclipse IDE Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic