My application is a hybrid of Servlets and Spring.
Most pages are divided in subsections, included in the main jsp using jsp:include. I'm having some issues when the target of the import is a REST call instead of an actual JSP page.
I had to change the paths from "../rest/xyz" to "${contextPath}/rest/xyz" because sometimes the first version would result in "appName/rest/rest/xyz".
However, I am still facing issues from time to time when there are nested includes: the resulting path is "appName/appName/rest...". I am struggling to find a syntax that works for all the cases.
Is there a better way to do it?
EXAMPLE:
in books.jsp I have
<jsp:include page="/jsp/library/chapters.jsp"/>
then in chapters.jsp I have
<jsp:include page="/rest/paragraphs?chapter=x"/>
But I cannot get the path to paragraphs right:
${contextPath}/rest/paragraphsresults inappName/appName/rest/paragraphs../rest/paragraphsresults inappName/jsp/library/../rest/paragraphs
It's best practice to declare your paths relative to the root (eg start your paths with
/)