Spring MVC @PathVariable dot(.) get truncated Example

Date: 2019-01-21
This tutorial demonstrates how to resolve the issue of Spring MVC's @PathVariable
annotation truncating strings containing dots. The problem occurs when a URI parameter with a dot (e.g., "xxx.xx") is passed; the portion after the last dot is removed. The solution involves creating a Spring MVC application (using Maven, Eclipse, and Tomcat) with a controller that correctly handles such parameters. The tutorial provides step-by-step instructions, including project setup, configuration files (pom.xml
, web.xml
, mydispatcher-servlet.xml
), controller code, and JSP views. The corrected controller avoids truncation, allowing the full parameter value to be processed.
Subscribe to my newsletter
Read articles from Yatin B. directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
