You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Olivier Brand <ol...@intraware.com> on 2000/08/01 02:09:47 UTC
Accessing a JSP from a servlet in a new context
I have installed Tomcat and ran all the sample applications without any
problems.
I have created a new directory: intraware, just under webapps (same
level than examples), where I have put an entire j2ee Servlet?jsp base
application.
The structure of such directory is as follow:
%TOMCAT_HOME%\webapps\intraware
\templates\...
\Web-Inf
\web.xml
\classes\...
I am calling the index servlet using the URL:
http://localhost:8080/intraware/servlet/index
Everything works ok untill the end where I am using the
requestDispatcher to redirect to a JSP using the following path:
\templates\...
The getRequestDispatcher method returns null !!
Now when I am typing the following URL to access a JSP, it works !!:
http://localhost:8080/intraware/templates/...
Maybe I am missing an important piece in all the "not so documented"
config files of Tomcat.
I have added in the server.xml the following:
<Context path="/intraware" docBase="webapps/intraware" debug="0"
reloadable="true">
</Context>
Did I forgot to add any other information ?
Any help will be appreciated
Thanks
Olivier
Re: Accessing a JSP from a servlet in a new context
Posted by Hans Bergsten <ha...@gefionsoftware.com>.
Olivier Brand wrote:
>
> Hans,
>
> In fact I am using the "/", which is being converted by Tomcat on NT to "\"
> internally. But This not the problem here, I am more thinking of a
> configuration problem.
> My program works on BEA and iPlanet6, I don't see why it won't work on the
> SUN implementation, since the JSP call is trivial.
>
> Any other idea ?
Sorry, then I don't know. I'm using getRequestDispatcher() in many places
with Tomcat 3.1/3.2b2 without problem. Have you tried with Tomcat 3.2 Beta 2?
Hans
--
Hans Bergsten hans@gefionsoftware.com
Gefion Software http://www.gefionsoftware.com
Re: Accessing a JSP from a servlet in a new context
Posted by Olivier Brand <ol...@intraware.com>.
Hans,
In fact I am using the "/", which is being converted by Tomcat on NT to "\"
internally. But This not the problem here, I am more thinking of a
configuration problem.
My program works on BEA and iPlanet6, I don't see why it won't work on the
SUN implementation, since the JSP call is trivial.
Any other idea ?
Olivier
Hans Bergsten wrote:
> Olivier Brand wrote:
> >
> > I have installed Tomcat and ran all the sample applications without any
> > problems.
> >
> > I have created a new directory: intraware, just under webapps (same
> > level than examples), where I have put an entire j2ee Servlet?jsp base
> > application.
> >
> > The structure of such directory is as follow:
> >
> > %TOMCAT_HOME%\webapps\intraware
> >
> > \templates\...
> >
> > \Web-Inf
> >
> > \web.xml
> >
> > \classes\...
> >
> > I am calling the index servlet using the URL:
> >
> > http://localhost:8080/intraware/servlet/index
> >
> > Everything works ok untill the end where I am using the
> > requestDispatcher to redirect to a JSP using the following path:
> > \templates\...
> > The getRequestDispatcher method returns null !!
>
> The argument to getRequestDispatcher() is a URI, not a filepath. And
> URIs always use forward slashes, not backward slashes, independent on
> the OS you use. Try with "/templates/..." instead.
>
> Hans
> --
> Hans Bergsten hans@gefionsoftware.com
> Gefion Software http://www.gefionsoftware.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org
Re: Accessing a JSP from a servlet in a new context
Posted by Olivier Brand <ol...@intraware.com>.
Hans,
Thanks for your help. I am so UNIX oriented that I haven't seen the impact on
the URI. I am converting the '\' to '/' and everything works fine. (I wrote
in fact a dynamic dispatcher lnaguga and look & feel sensitive, the URI was
converted to a filesystem path on purpose). The taglib is working fine too.
In fact everything works pretty good.
Olivier
Hans Bergsten wrote:
> Olivier Brand wrote:
> >
> > I have installed Tomcat and ran all the sample applications without any
> > problems.
> >
> > I have created a new directory: intraware, just under webapps (same
> > level than examples), where I have put an entire j2ee Servlet?jsp base
> > application.
> >
> > The structure of such directory is as follow:
> >
> > %TOMCAT_HOME%\webapps\intraware
> >
> > \templates\...
> >
> > \Web-Inf
> >
> > \web.xml
> >
> > \classes\...
> >
> > I am calling the index servlet using the URL:
> >
> > http://localhost:8080/intraware/servlet/index
> >
> > Everything works ok untill the end where I am using the
> > requestDispatcher to redirect to a JSP using the following path:
> > \templates\...
> > The getRequestDispatcher method returns null !!
>
> The argument to getRequestDispatcher() is a URI, not a filepath. And
> URIs always use forward slashes, not backward slashes, independent on
> the OS you use. Try with "/templates/..." instead.
>
> Hans
> --
> Hans Bergsten hans@gefionsoftware.com
> Gefion Software http://www.gefionsoftware.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org
Re: Accessing a JSP from a servlet in a new context
Posted by Hans Bergsten <ha...@gefionsoftware.com>.
Olivier Brand wrote:
>
> I have installed Tomcat and ran all the sample applications without any
> problems.
>
> I have created a new directory: intraware, just under webapps (same
> level than examples), where I have put an entire j2ee Servlet?jsp base
> application.
>
> The structure of such directory is as follow:
>
> %TOMCAT_HOME%\webapps\intraware
>
> \templates\...
>
> \Web-Inf
>
> \web.xml
>
> \classes\...
>
> I am calling the index servlet using the URL:
>
> http://localhost:8080/intraware/servlet/index
>
> Everything works ok untill the end where I am using the
> requestDispatcher to redirect to a JSP using the following path:
> \templates\...
> The getRequestDispatcher method returns null !!
The argument to getRequestDispatcher() is a URI, not a filepath. And
URIs always use forward slashes, not backward slashes, independent on
the OS you use. Try with "/templates/..." instead.
Hans
--
Hans Bergsten hans@gefionsoftware.com
Gefion Software http://www.gefionsoftware.com