I'm trying to get a file in the filesystem relative to the location of a 
JSP Page. At first Blush the following would seem appropriate:

<%
String jsp_location = application.getRealPath(request.getServletPath());

String relative = jsp_location.substring(0,jsp_location.lastIndexOf("/"));

... get the resource using this path ...

%>

however, when one uses a servlet mapping on a JSP Page like below.

  <servlet>
    <servlet-name>JSPTestMap</servlet-name>
    <jsp-file>/Jaxp/JSPTransformExample.jsp</jsp-file>
  </servlet>
  <servlet-mapping>
    <servlet-name>JSPTestMap</servlet-name>
    <url-pattern>/Jaxp/MapExample.jsp</url-pattern>
  </servlet-mapping>

request.getServletPath() returns

<url-pattern>/Jaxp/MapExample.jsp</url-pattern>

and not

<jsp-file>/Jaxp/JSPTransformExample.jsp</jsp-file>

is there any way I can get hold of the original real location of the JSP 
Page I'm working in and have it also work with servlet-mappings?

-Mark Diggory






--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to