Add the application context path into application.properties file and read the context path into the JSP file.
Maven Dependencies
<dependency> <groupId>org.apache.tomcat</groupId> <artifactId>jsp-api</artifactId> <version>6.0.32</version> <scope>provided</scope> </dependency> <dependency> <groupId>taglibs</groupId> <artifactId>standard</artifactId> <version>1.1.2</version> <type>jar</type> <scope>compile</scope> </dependency>
Add JSTL lib
<%@taglib uri="http://www.springframework.org/tags" prefix="s"%> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@page isELIgnored="false"%>
Add ConextPath into application.properties
server.servlet.context-path=/ProductStore
Read context Path into JSP
${pageContext.request.contextPath} is used to read context path form applicaiton.properties to jsp page.
<a class="nav-link" href="${pageContext.request.contextPath}/welcomepage">Home <span class="sr-only">(current)</span></a>