title: Getting servlet path by using <c:url> or ${pageContext.request} in InternalResourceViewResolver of Spring
body: <p>I'm using <code>InternalResourceViewResolver</code> from Spring to render view existing in <code>/WEB-INF/view</code>. I also use JSTL in view. Now the problem comes after change <code>&lt;url-pattern&gt;</code> of <code>DispatcherServlet</code> in <code>web.xml</code>.</p>
  
  <p>I tried to get servlet path by <code>${pageContext.request.servletPath}</code> but it returns <code>/WEB-INF/view/skel/welcome.jsp</code> which is the path from WEB-INF directory, while <code>request.getServletPath()</code> returns <code>/h2o</code> inside of controller Java code. <code>&lt;% out.print(request.getServletPath()); %&gt;</code> also returns <code>/WEB-INF/view/skel/welcome.jsp</code> in view file (<code>/WEB-INF/view/skel/welcome.jsp</code>).</p>
  
  <p>It seems to come from difference between request instances in controller Java code &amp; JSP view file. Request is instance of <code>org.apache.catalina.core.ApplicationHttpRequest</code> in JSP view file, but it's instance of <code>org.apache.catalina.connector.RequestFacade</code> in controller Java code. </p>
  
  <p>Until now, fortunately, we install it alone and didn't need to care about <code>&lt;uri-patter&gt;</code> or servlet path. But this project requires integration with other system so getting servlet path from view file to map correct URL of some menu or form action target.</p>
  
  <p>Do you have any idea to get correct servlet path (<code>/h2o</code>) from view file?</p>