title: @RequestParam in Spring MVC handling optional parameters
body: <p>Is it possible for a Spring controller to handle both kind of requests? </p>
  
  <p>1) <code>http://localhost:8080/submit/id/ID123432?logout=true</code></p>
  
  <p>2) <code>http://localhost:8080/submit/id/ID123432?name=sam&amp;password=543432</code></p>
  
  <p>If I define a single controller of the kind:</p>
  
  <pre><code> @RequestMapping (value = "/submit/id/{id}", method = RequestMethod.GET,   
   produces="text/xml")
  public String showLoginWindow(@PathVariable("id") String id,
                                @RequestParam(value = "logout", required = false) String logout,
                                @RequestParam("name") String username,
                                @RequestParam("password") String password,
                                @ModelAttribute("submitModel") SubmitModel model,
                                BindingResult errors) throws LoginException {...}
  </code></pre>
  
  <p>the HTTP request with "logout" is not accepted.</p>
  
  <p>If I define two controllers to handle each request separately, Spring complains with the exception "There is already 'Controller' bean method ... mapped".</p>