File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Monica Shiralkar
Ranch Hand
Posts: 825
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 77
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic