Spring @PathVariable Annotation

In Spring Web MVC, we can use the @PathVariable annotation to access the captured URI variables. Table of contents: 1. Basic Mapping 2. Basic Mapping – Different Name 3. Basic Mapping – Class and method levels 4. Multiple Captured URI Variables 5. Multiple Captured URI Variables – Map Version 6. Regex Mapping 7. @PathVariable variables …

Read more

Spring @PathVariable – Why is value truncated after the last (.)dot?

Review the below @PathVariable example. @RequestMapping("/site") public class SiteController { @RequestMapping(value = "/{q}", method = RequestMethod.GET) public ModelAndView display(@PathVariable("q") String q) { return getModelAndView(q, "site"); } } See the following cases : For input /site/google, q = google For input /site/google.com, q = google where is the .com? For input /site/google.com.my, q = google.com For …

Read more