+1 vote
332 views
asked by (8.2k points)

Hi

  What is the Difference between @RequestParam and @PathVariable?

1 Answer

0 votes
answered by (2.6k points)

Hi 

    Both annotations @RequestParam and @PathVariable in Spring MVC are used for fetching the values of request parameters. 

    These annotations have similar purpose but some differences in use. 

    The key difference between @RequestParam and @PathVariable is that @RequestParam used for accessing the values of the query parameters where as @PathVariable used for accessing the values from the URI template.

commented by (2.6k points)
http://localhost:8080/tutorials/bookmark/100?site=dineshonjava

site is  @RequestParam
100 is @PathVariable

Categories

...