You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Tim Kettering <ti...@mac.com> on 2002/08/28 23:03:20 UTC
Re: Again! Location of JSP page the Taglib is executing in
(really Stuck on this one, PLEASE HELP).
Um, this code snippet is in one of my servlets, not a JSP page, but however,
since JSP pages do get compiled to servlets, this might be a clue to an
solution for you?
There may be a more efficient way to do this, but this works perfectly fine
for me for determining where the root directory of the web-application is on
the physical server drive.
URL theUrl = sc.getResource("/");
String webapp_base_dir = theUrl.getFile();
return webapp_base_dir;
> I really can't get to the bottom of this one.
>
> Is there any way to get to the "TRUE" filesystem location of the JSP
> page I am within? Even if the URI is Mapped through ServletMapping like
> below? I've tried getRealPath(...) and this is not accurate on the
> Tomcat 4.0.3 version I'm currently using.
>
> I need to get
>
> /var/tomcat4/webapps/Jaxp/JSPTransformExample.jsp (which really exists!)
>
> not
>
> /var/tomcat4/webapps/Jaxp/MapExample.jsp (which is virtual and doesn't
> exist!)
>
>>
>> <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>
>
>
> -Mark Diggory
>
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
--
Tim Kettering
timster@mac.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Again! Location of JSP page the Taglib is executing in (really
Stuck on this one, PLEASE HELP).
Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
Maybe this discussion would be more appropriate on the main
Tomcat/Catalina list. I'll post it there instead.
Mark R. Diggory wrote:
> This gives me an interesting URL in return, I assume this is out of
> Tomcats JNDI Context.
>
> <%java.net.URL theUrl =
> pageContext.getServletContext().getResource("/");%>
> <%=theUrl.toString()%><BR>
>
> returns
>
> jndi:/localhost/Taglib/
>
> Not quite there, Is there a way to get
>
> Tim Kettering wrote:
>
>> Um, this code snippet is in one of my servlets, not a JSP page, but
>> however,
>> since JSP pages do get compiled to servlets, this might be a clue to an
>> solution for you?
>>
>> There may be a more efficient way to do this, but this works
>> perfectly fine
>> for me for determining where the root directory of the
>> web-application is on
>> the physical server drive.
>>
>> URL theUrl = sc.getResource("/");
>> String webapp_base_dir = theUrl.getFile();
>> return webapp_base_dir;
>>
>>
>>
>>
>>
>>> I really can't get to the bottom of this one.
>>>
>>> Is there any way to get to the "TRUE" filesystem location of the JSP
>>> page I am within? Even if the URI is Mapped through ServletMapping like
>>> below? I've tried getRealPath(...) and this is not accurate on the
>>> Tomcat 4.0.3 version I'm currently using.
>>>
>>> I need to get
>>>
>>> /var/tomcat4/webapps/Jaxp/JSPTransformExample.jsp (which really
>>> exists!)
>>>
>>> not
>>>
>>> /var/tomcat4/webapps/Jaxp/MapExample.jsp (which is virtual and doesn't
>>> exist!)
>>>
>>>
>>>
>>>> <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>
>>>>
>>>
>>> -Mark Diggory
>>>
>>>
>>>
>>> --
>>> To unsubscribe, e-mail:
>>> <ma...@jakarta.apache.org>
>>> For additional commands, e-mail:
>>> <ma...@jakarta.apache.org>
>>>
>>>
>>
>>
>>
>>
>
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Again! Location of JSP page the Taglib is executing in (really
Stuck on this one, PLEASE HELP).
Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
This gives me an interesting URL in return, I assume this is out of
Tomcats JNDI Context.
<%java.net.URL theUrl = pageContext.getServletContext().getResource("/");%>
<%=theUrl.toString()%><BR>
returns
jndi:/localhost/Taglib/
Not quite there, Is there a way to get
Tim Kettering wrote:
>Um, this code snippet is in one of my servlets, not a JSP page, but however,
>since JSP pages do get compiled to servlets, this might be a clue to an
>solution for you?
>
>There may be a more efficient way to do this, but this works perfectly fine
>for me for determining where the root directory of the web-application is on
>the physical server drive.
>
> URL theUrl = sc.getResource("/");
> String webapp_base_dir = theUrl.getFile();
> return webapp_base_dir;
>
>
>
>
>
>>I really can't get to the bottom of this one.
>>
>>Is there any way to get to the "TRUE" filesystem location of the JSP
>>page I am within? Even if the URI is Mapped through ServletMapping like
>>below? I've tried getRealPath(...) and this is not accurate on the
>>Tomcat 4.0.3 version I'm currently using.
>>
>>I need to get
>>
>>/var/tomcat4/webapps/Jaxp/JSPTransformExample.jsp (which really exists!)
>>
>>not
>>
>>/var/tomcat4/webapps/Jaxp/MapExample.jsp (which is virtual and doesn't
>>exist!)
>>
>>
>>
>>> <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>
>>>
>>>
>>-Mark Diggory
>>
>>
>>
>>--
>>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>>For additional commands, e-mail: <ma...@jakarta.apache.org>
>>
>>
>>
>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>