0

HomeController.java I have web page which loads the pages dynamically. My first Mapping method loads the appropriate pages as per the product choosed. I hav a menu in each product page and I need the second mapping method to execute. But it always executes the first one. What should I do to execute the second one?

   @RequestMapping("/page/{pagename}")
     public ModelAndView loadProductPage(ModelMap model, @PathVariable("pagename") String pagename) {
     System.out.println("Load Product Page");
     model.addAttribute("productname",pagename);
     return new ModelAndView("products/"+pagename+"/"+pagename);
 }


 @RequestMapping("/page/loadpage/{choosedProduct}/{linkChoosed}")
 public ModelAndView loadProductMenuPages(ModelMap model, @PathVariable("linkChoosed") String linkChoosed, @PathVariable("choosedProduct") String choosedProduct) {
    System.out.println("Product Choosed" + choosedProduct);
    System.out.println("Link Choosed" + linkChoosed);
     return new ModelAndView("products/"+choosedProduct+"/"+linkChoosed);
 }
Aniket Kulkarni
  • 12,825
  • 9
  • 67
  • 90
  • Throws an error even after changing the second mapping method to @RequestMapping("/page/loadpage/{choosedProduct}/{linkChoosed}") –  Mar 24 '15 at 10:22
  • what error message you are receiving ? – Naveen Ramawat Mar 24 '15 at 10:32
  • I am getting the following error message @NaveenRamawat HTTP Status 404 - /controller/WEB-INF/views/products/loadpage/loadpage.jsp –  Mar 24 '15 at 10:46
  • If that was the error, looks like the problem is that the view doesn't exist. In case of an error in the spring code, a 500 error is thrown. /controller/WEB-INF/.. doesn't seem right. Are your views in the controller folder? – Karthik Mar 24 '15 at 11:01

1 Answers1

0

Maybe changing the order (move the second method above the first one) might help.