Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is the difference between using @RequestMapping before class and before method

 
Abhra Kar
Ranch Hand
Posts: 150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between these two---

@Controller
public class HomeController {

@RequestMapping("/home")
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
......................................................................................................
......................................................................................................
}
}


and

@Controller
@RequestMapping("/home.htm")
public class HomeController {
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
......................................................................................................
......................................................................................................
}
}


If we want to call a controller against home.html(properly defined in dispatcher-servlet.xml) can we use any one of this interchangeably


waiting for reply
please help
thanks in advance
 
Boris Romashov
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@RequestMapping on class makes that URL to be base for all @RequestMapping on methods.
 
Abhra Kar
Ranch Hand
Posts: 150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for the help
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic