title: What are valid return types of a Spring MVC controller method?
body: <p>I have not much experience in Spring MVC and I have the following about <strong>what are  the valids return types that a controller method can return</strong>.</p>
  
  <p>So I know that the user generate an <strong>HttpRequest</strong> received and handled by the <strong>DispatcherServlet</strong> that dispatch this request to a specific controller class.</p>
  
  <p>A controller class is something like this:</p>
  
  <pre><code>@Controller
  public class AccountController {
  
      @RequestMapping("/showAccount")
      public String show(@RequestParam("entityId") long id, Model model) {
          ...
      }
  
      .......................................
      .......................................
      .......................................
  }
  </code></pre>
  
  <p>So I know that each method handle a specific request and that the handled request is specified by the <strong>@RequestMapping</strong> annotation.</p>
  
  <p>I also know that the method return a <strong>String</strong> object that is the <strong>logical view name</strong> (that then is resolved by the <strong>view resolver</strong> to render the view)</p>
  
  <p>So, at this stage, I think that a method of a controller class returns only <strong>String</strong> object. But I am not sure of it. Maybe a method like this can return also some different kind of objects?</p>