A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Java EE 7 Tutorial Volume 1 or Volume 2
this week in the
jQuery UI in Action
is it necessary that method of Controller Class of Spring should return a Model and View Object?
Joined: Jul 07, 2012
Oct 05, 2012 14:03:17
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
Joined: Jan 19, 2011
Oct 06, 2012 03:03:18
hi Monica. Shiralkar,
No its not necessary that every time you should return ModelAndView object. you can also return Map or List.
(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.
It is sorta covered in the
JavaRanch Style Guide
subject: is it necessary that method of Controller Class of Spring should return a Model and View Object?
different approaches to MVC
One view/controller, pluggable models
Decoupling the GUI
Spring MVC -- where does the model code go?
Spring MVC 3.0 Controller Unit testing
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014