title: Spring MVC binding to same @RequestMapping
body: <p>Suppose we have this code for login &amp; we want if the credential was for admin page the RequestMapping be for admin &amp; if it was for user credential the user redirect to user panel.
  now, the main page of both oppose the same url as I defined in my code below, something like :</p>
  
  <pre><code>http://localhost:8080/project/{username}/main
  </code></pre>
  
  <p>my question is :</p>
  
  <p>how we can separate these two method in here when they have the same RequestMapping "main" after the login checking finished inside the Controller class?</p>
  
  <pre><code>@RequestMapping(value = "/login")
  public String welcome(@RequestParam("j_username") String username, @RequestParam("j_password") String password, HttpSession session, Model model) throws RemoteException, NotBoundException {
  
      int checkAccount = uiClient.checkAdminAccount(username, password);
      if (checkAccount == 1) {
          session.setAttribute("username", username);
          return "redirect:/" + username + "/main";
      } else if (checkAccount == 0) {
          checkAccount = uiClient.checkAccount(username, password);
          if (checkAccount == 1) {
              session.setAttribute("username", username);
              return "redirect:/" + username + "/main";
          } else if (checkAccount == 0) {
              return "login";
          }
      } else {
          return "databaseError";
      }
      return "login";
  }
  
  @RequestMapping(value = "/{username}/main")
  public String indexPage(@PathVariable("username") String username) {
      return "/user/userPanel";
  }
  
  @RequestMapping(value = "{username}/main")
  public String adminIndexPage(@PathVariable("username") String username){
      return "/admin/adminPanel";
  }
  </code></pre>
  
  <p>I mean, is there any way like special tag or something that we can put for each Mapping &amp; separate them after the login process finished so the admin redirect to adminPanel &amp; the user also redirect to userPanel but both with the same url:</p>
  
  <pre><code>http://localhost:8080/project/{username}/main
  </code></pre>
  
  <p>???</p>