Spring MVC: Mapping Multiple URLs to Same Controller

Since nobody seems to have put the full answer on here yet:

The @RequestMapping annotation can take an array for its “value” parameter. To map this at the controller level using the first pattern, you would use:

@Controller
@RequestMapping(value={"https://stackoverflow.com/formA.html", "/formB.html", "/formC.html"})
public class ControllerA {

}

And then:

@Controller
@RequestMapping(value="/formD.html")
public class ControllerD {

}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)