Spring controller declaration

I am wondering what are the requirements for a method (or a class) to be labeled with @Controller? As for input arguments, the Spring tutorial seems to indicate that methods can sometimes take in nothing and sometimes take in a Model object:

http://blog.springsource.com/2011/01/04/green-beans-getting-started-with-spring-mvc/

And this:

Spring MVC Controllers Return Type

seems to indicate that the return type can be a String or a ModelAndView. I tried to look that up in the official documentation but couldn't find much info. I presume there must be some requirements. Any pointers?

Answers


In Spring Class is marked as @Controller, methods are marked as @RequestMapping handling specific request based on parameter,url path, accept header etc.

Spring MVC is highly flexible and allows you to have many return types see spring reference see "Supported method return types" section on the same page.

Also spring-mvc-3-showcase blog


Need Your Help

How do I get the resolution of the main monitor in Mac OS X in C++?

c++ osx graphics resolution

I have a graphical app that needs to test the resolution of the display it is starting up on in Mac OS X to ensure it is not larger than the resolution. This is done before the window itself is

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.