I have not much experience in Spring MVC and I have the following about what are the valids return types that a controller method can return.
So I know that the user generate an HttpRequest received and handled by the DispatcherServlet that dispatch this request to a specific controller class.
A controller class is something like this:
@Controller
public class AccountController {
@RequestMapping("/showAccount")
public String show(@RequestParam("entityId") long id, Model model) {
...
}
.......................................
.......................................
.......................................
}
So I know that each method handle a specific request and that the handled request is specified by the @RequestMapping annotation.
I also know that the method return a String object that is the logical view name (that then is resolved by the view resolver to render the view)
So, at this stage, I think that a method of a controller class returns only String object. But I am not sure of it. Maybe a method like this can return also some different kind of objects?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…