Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what objects can we return from the methods of controller?

 
Twoz Lee
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

usually the return object from the method in controller class are ModelAndView.

I just wonder what kind of object, we can return and can we redirect to other path in controller.

Also, I wonder where we can obtain the information.

 
Marc Cracco
Ranch Hand
Posts: 80
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Twoz Lee wrote:Dear all,

usually the return object from the method in controller class are ModelAndView.

I just wonder what kind of object, we can return and can we redirect to other path in controller.

Also, I wonder where we can obtain the information.



I'm not sure which methods in your controller class you're referring to. For example if you're using a SimpleFromController and handleRequest() then it is
an implementation of org.springframework.web.servlet.mvc.Controller Interface and the API is :

Method Summary

ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
Process the request and return a ModelAndView object which the DispatcherServlet will render.

So all you can return is a ModelAndView... or a subclass
I believe it's the same for onSubmit()...

Is that what you were looking for?


Spring Framework Doc 2.5.6

Marc
 
Twoz Lee
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marc Cracco wrote:

I'm not sure which methods in your controller class you're referring to. For example if you're using a SimpleFromController and handleRequest() then it is
an implementation of org.springframework.web.servlet.mvc.Controller Interface and the API is :

Method Summary

ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
Process the request and return a ModelAndView object which the DispatcherServlet will render.

So all you can return is a ModelAndView... or a subclass
I believe it's the same for onSubmit()...

Is that what you were looking for?


Spring Framework Doc 2.5.6

Marc



i use annotation - Controller , so i do not extends different SimpleFromController or other controllers

btw, where do you get the information that we can return ModelAndView and its subclass.

and also in the example method that which includes HttpServletRequest, HttpServletResponse .

where do you get the information in which documents?

 
Marc Cracco
Ranch Hand
Posts: 80
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure I understand exactly what you're looking for... Can you give me more information as to what exactly you're doing. Also you ask where I get my information? In the Documentation I included the link to in my last post.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic