aspose file tools*
The moose likes Spring and the fly likes is it necessary that method of Controller Class of Spring should return a Model and View Object?  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "is it necessary that method of Controller Class of Spring should return a Model and View Object?  " Watch "is it necessary that method of Controller Class of Spring should return a Model and View Object?  " New topic
Author

is it necessary that method of Controller Class of Spring should return a Model and View Object?

Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 541
is it necessary that method of Controller Class of Spring should return a Model and View Object? if no then what else can this method have insted of returning model and view object
Prashant Chindhade
Ranch Hand

Joined: Jan 19, 2011
Posts: 77
hi Monica. Shiralkar,

No its not necessary that every time you should return ModelAndView object. you can also return Map or List.

and string(which will be accounted as view name).

Suppose you are doing Ajax call to controller and you want list of objects returned from controller than you need to put @RequestMapping annotation(if you are using Spring MVC 3.0 or above) before controller method name that you want to call.

thanks
Prashant
 
jQuery in Action, 2nd edition
 
subject: is it necessary that method of Controller Class of Spring should return a Model and View Object?
 
Similar Threads
Spring MVC -- where does the model code go?
One view/controller, pluggable models
Spring MVC 3.0 Controller Unit testing
Decoupling the GUI
different approaches to MVC