You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dave Robbins <dr...@drobbins.net> on 2002/09/11 18:37:09 UTC
relative path/context problem
Hello All,
I'm seeing some really odd behaviour, I hope someone can tell me what i'm
doing wrong. I've written some jsp/servlet code with Forte 4.0, created a
war file and deployed it on Tomcat 4.0.4. ( I deployed it by putting the
war file in the webapps dir and restarting Tomcat) The war file was
my_stuff.war so the url is
http://localhost:8080/my_stuff/index.jsp
That works fine. As I started developing a little code I got to a point I
wanted a link back to the entry of the site, I thought
<a href="/index.jsp">Back to Top</a>
would do the job. But this link pointed to
http://localhost:8080/my_stuff/servlet/index.jsp
I was confused so to simplify things I went back to index.jsp and put a
link to itself in the file. When you mouse over the link, the address it
point to is
http://localhost:8080/index.jsp
Shouldn't Tomcat be prepending
http://localhost:8080/my_stuff
onto any link I specify like this
<a href="/somefile.jsp">My Link</a>
I'm playing around with what's called a model 2 architecture where a jsp
page calls a servlet which does some data processing and then forwards the
request to another jsp page and I'm not having any trouble with path's when
I forward the request, just with links in the jsp pages.
what's really maddening is that in playing around with this I've seen it
work correctly and seen it fail. Obviously I'm doing something boneheaded,
any ideas??
Dave
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: relative path/context problem
Posted by Dave Robbins <dr...@drobbins.net>.
I have 1 servlet name EntryBean in a package called phonebook
should web.xml have entries for jsp pages?
here's the whole file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>EntryBean</servlet-name>
<servlet-class>phonebook.EntryBean</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>EntryBean</servlet-name>
<url-pattern>/servlet/phonebook.EntryBean</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
<welcome-file>
index.html
</welcome-file>
<welcome-file>
index.htm
</welcome-file>
</welcome-file-list>
</web-app>
> What servlet mapping(s) do you have setup in web.xml?
>
> Dave Robbins wrote:
>> Hello All,
>>
>> I'm seeing some really odd behaviour, I hope someone can tell me what
>> i'm doing wrong. I've written some jsp/servlet code with Forte 4.0,
>> created a war file and deployed it on Tomcat 4.0.4. ( I deployed it
>> by putting the war file in the webapps dir and restarting Tomcat) The
>> war file was my_stuff.war so the url is
>>
>> http://localhost:8080/my_stuff/index.jsp
>>
>> That works fine. As I started developing a little code I got to a
>> point I wanted a link back to the entry of the site, I thought
>>
>> <a href="/index.jsp">Back to Top</a>
>>
>> would do the job. But this link pointed to
>>
>> http://localhost:8080/my_stuff/servlet/index.jsp
>>
>> I was confused so to simplify things I went back to index.jsp and put
>> a link to itself in the file. When you mouse over the link, the
>> address it point to is
>>
>> http://localhost:8080/index.jsp
>>
>> Shouldn't Tomcat be prepending
>>
>> http://localhost:8080/my_stuff
>>
>> onto any link I specify like this
>>
>> <a href="/somefile.jsp">My Link</a>
>>
>> I'm playing around with what's called a model 2 architecture where a
>> jsp page calls a servlet which does some data processing and then
>> forwards the request to another jsp page and I'm not having any
>> trouble with path's when I forward the request, just with links in
>> the jsp pages.
>>
>> what's really maddening is that in playing around with this I've seen
>> it work correctly and seen it fail. Obviously I'm doing something
>> boneheaded, any ideas??
>>
>> Dave
>>
>>
>>
>>
>>
>>
>>
>> --
>> 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: relative path/context problem
Posted by rob <ro...@softhome.net>.
What servlet mapping(s) do you have setup in web.xml?
Dave Robbins wrote:
> Hello All,
>
> I'm seeing some really odd behaviour, I hope someone can tell me what i'm
> doing wrong. I've written some jsp/servlet code with Forte 4.0, created a
> war file and deployed it on Tomcat 4.0.4. ( I deployed it by putting the
> war file in the webapps dir and restarting Tomcat) The war file was
> my_stuff.war so the url is
>
> http://localhost:8080/my_stuff/index.jsp
>
> That works fine. As I started developing a little code I got to a point I
> wanted a link back to the entry of the site, I thought
>
> <a href="/index.jsp">Back to Top</a>
>
> would do the job. But this link pointed to
>
> http://localhost:8080/my_stuff/servlet/index.jsp
>
> I was confused so to simplify things I went back to index.jsp and put a
> link to itself in the file. When you mouse over the link, the address it
> point to is
>
> http://localhost:8080/index.jsp
>
> Shouldn't Tomcat be prepending
>
> http://localhost:8080/my_stuff
>
> onto any link I specify like this
>
> <a href="/somefile.jsp">My Link</a>
>
> I'm playing around with what's called a model 2 architecture where a jsp
> page calls a servlet which does some data processing and then forwards the
> request to another jsp page and I'm not having any trouble with path's when
> I forward the request, just with links in the jsp pages.
>
> what's really maddening is that in playing around with this I've seen it
> work correctly and seen it fail. Obviously I'm doing something boneheaded,
> any ideas??
>
> Dave
>
>
>
>
>
>
>
> --
> 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: relative path/context problem
Posted by Jacob Kjome <ho...@visi.com>.
Hello Dave,
The issue is that you are specifying a path to the root of your
server. Any time you provide "/mypage.html", it will ignore the
current directory you are in and reference the root of the web server.
What you want is "./mypage.html" or just "mypage.html".
What you should be doing when using MVC, though is choose a mapping
for pages that are to go through you controller servlet. The
Barracuda project generally maps "*.event" to the controller. So, no
matter where you are in your directory hierarchy of your current
context, the appropriate event will be fired. However, even in this
case, if your context we "/mycontext" and your link inside a page in
that context was "/myevent.event", this still would end up going to
the root of your webserver and not be served by the current webapp
context. Instead, you would use "./myevent.event" or just
"myevent.event" as the URL.
Does that make sense?
Jake
Wednesday, September 11, 2002, 11:37:09 AM, you wrote:
DR> Hello All,
DR> I'm seeing some really odd behaviour, I hope someone can tell me what i'm
DR> doing wrong. I've written some jsp/servlet code with Forte 4.0, created a
DR> war file and deployed it on Tomcat 4.0.4. ( I deployed it by putting the
DR> war file in the webapps dir and restarting Tomcat) The war file was
DR> my_stuff.war so the url is
DR> http://localhost:8080/my_stuff/index.jsp
DR> That works fine. As I started developing a little code I got to a point I
DR> wanted a link back to the entry of the site, I thought
DR> <a href="/index.jsp">Back to Top</a>
DR> would do the job. But this link pointed to
DR> http://localhost:8080/my_stuff/servlet/index.jsp
DR> I was confused so to simplify things I went back to index.jsp and put a
DR> link to itself in the file. When you mouse over the link, the address it
DR> point to is
DR> http://localhost:8080/index.jsp
DR> Shouldn't Tomcat be prepending
DR> http://localhost:8080/my_stuff
DR> onto any link I specify like this
DR> <a href="/somefile.jsp">My Link</a>
DR> I'm playing around with what's called a model 2 architecture where a jsp
DR> page calls a servlet which does some data processing and then forwards the
DR> request to another jsp page and I'm not having any trouble with path's when
DR> I forward the request, just with links in the jsp pages.
DR> what's really maddening is that in playing around with this I've seen it
DR> work correctly and seen it fail. Obviously I'm doing something boneheaded,
DR> any ideas??
DR> Dave
DR> --
DR> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
DR> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
Best regards,
Jacob mailto:hoju@visi.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: relative path/context problem
Posted by Mauro Daniel Ardolino <ma...@altersoft.com.ar>.
Thanks! but is only experience (yesterday I had the same problem ;)
On Wed, 11 Sep 2002, Dave Robbins wrote:
> you sir, are incredibly smart
> Thanks
>
> > I think it will work if you take out the "/".
> > Like this:
> > <a href="index.jsp">Back to Top</a>
> >
> > Tell me.
> >
> > Bye,
> >
> > Mauro
> >
> >
> >
> > On Wed, 11 Sep 2002, Dave Robbins wrote:
> >
> >> Hello All,
> >>
> >> I'm seeing some really odd behaviour, I hope someone can tell me what
> >> i'm doing wrong. I've written some jsp/servlet code with Forte 4.0,
> >> created a war file and deployed it on Tomcat 4.0.4. ( I deployed it
> >> by putting the war file in the webapps dir and restarting Tomcat) The
> >> war file was my_stuff.war so the url is
> >>
> >> http://localhost:8080/my_stuff/index.jsp
> >>
> >> That works fine. As I started developing a little code I got to a
> >> point I wanted a link back to the entry of the site, I thought
> >>
> >> <a href="/index.jsp">Back to Top</a>
> >>
> >> would do the job. But this link pointed to
> >>
> >> http://localhost:8080/my_stuff/servlet/index.jsp
> >>
> >> I was confused so to simplify things I went back to index.jsp and put
> >> a link to itself in the file. When you mouse over the link, the
> >> address it point to is
> >>
> >> http://localhost:8080/index.jsp
> >>
> >> Shouldn't Tomcat be prepending
> >>
> >> http://localhost:8080/my_stuff
> >>
> >> onto any link I specify like this
> >>
> >> <a href="/somefile.jsp">My Link</a>
> >>
> >> I'm playing around with what's called a model 2 architecture where a
> >> jsp page calls a servlet which does some data processing and then
> >> forwards the request to another jsp page and I'm not having any
> >> trouble with path's when I forward the request, just with links in
> >> the jsp pages.
> >>
> >> what's really maddening is that in playing around with this I've seen
> >> it work correctly and seen it fail. Obviously I'm doing something
> >> boneheaded, any ideas??
> >>
> >> Dave
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> --
> >> To unsubscribe, e-mail:
> >> <ma...@jakarta.apache.org> For additional
> >> commands, e-mail: <ma...@jakarta.apache.org>
> >>
> >>
> >
> > --
> > Ing.Mauro Daniel Ardolino
> > Departamento de Desarrollo y Servicios
> > Altersoft
> > Billinghurst 1599 - Piso 9
> > C1425DTE - Capital Federal
> > Tel/Fax: 4821-3376 / 4822-8759
> > mailto: mauro@altersoft.com.ar
> > website: http://www.altersoft.com.ar
> >
> >
> > --
> > 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>
>
>
--
Ing.Mauro Daniel Ardolino
Departamento de Desarrollo y Servicios
Altersoft
Billinghurst 1599 - Piso 9
C1425DTE - Capital Federal
Tel/Fax: 4821-3376 / 4822-8759
mailto: mauro@altersoft.com.ar
website: http://www.altersoft.com.ar
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: relative path/context problem
Posted by Dave Robbins <dr...@drobbins.net>.
you sir, are incredibly smart
Thanks
> I think it will work if you take out the "/".
> Like this:
> <a href="index.jsp">Back to Top</a>
>
> Tell me.
>
> Bye,
>
> Mauro
>
>
>
> On Wed, 11 Sep 2002, Dave Robbins wrote:
>
>> Hello All,
>>
>> I'm seeing some really odd behaviour, I hope someone can tell me what
>> i'm doing wrong. I've written some jsp/servlet code with Forte 4.0,
>> created a war file and deployed it on Tomcat 4.0.4. ( I deployed it
>> by putting the war file in the webapps dir and restarting Tomcat) The
>> war file was my_stuff.war so the url is
>>
>> http://localhost:8080/my_stuff/index.jsp
>>
>> That works fine. As I started developing a little code I got to a
>> point I wanted a link back to the entry of the site, I thought
>>
>> <a href="/index.jsp">Back to Top</a>
>>
>> would do the job. But this link pointed to
>>
>> http://localhost:8080/my_stuff/servlet/index.jsp
>>
>> I was confused so to simplify things I went back to index.jsp and put
>> a link to itself in the file. When you mouse over the link, the
>> address it point to is
>>
>> http://localhost:8080/index.jsp
>>
>> Shouldn't Tomcat be prepending
>>
>> http://localhost:8080/my_stuff
>>
>> onto any link I specify like this
>>
>> <a href="/somefile.jsp">My Link</a>
>>
>> I'm playing around with what's called a model 2 architecture where a
>> jsp page calls a servlet which does some data processing and then
>> forwards the request to another jsp page and I'm not having any
>> trouble with path's when I forward the request, just with links in
>> the jsp pages.
>>
>> what's really maddening is that in playing around with this I've seen
>> it work correctly and seen it fail. Obviously I'm doing something
>> boneheaded, any ideas??
>>
>> Dave
>>
>>
>>
>>
>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org> For additional
>> commands, e-mail: <ma...@jakarta.apache.org>
>>
>>
>
> --
> Ing.Mauro Daniel Ardolino
> Departamento de Desarrollo y Servicios
> Altersoft
> Billinghurst 1599 - Piso 9
> C1425DTE - Capital Federal
> Tel/Fax: 4821-3376 / 4822-8759
> mailto: mauro@altersoft.com.ar
> website: http://www.altersoft.com.ar
>
>
> --
> 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: relative path/context problem
Posted by Mauro Daniel Ardolino <ma...@altersoft.com.ar>.
I think it will work if you take out the "/".
Like this:
<a href="index.jsp">Back to Top</a>
Tell me.
Bye,
Mauro
On Wed, 11 Sep 2002, Dave Robbins wrote:
> Hello All,
>
> I'm seeing some really odd behaviour, I hope someone can tell me what i'm
> doing wrong. I've written some jsp/servlet code with Forte 4.0, created a
> war file and deployed it on Tomcat 4.0.4. ( I deployed it by putting the
> war file in the webapps dir and restarting Tomcat) The war file was
> my_stuff.war so the url is
>
> http://localhost:8080/my_stuff/index.jsp
>
> That works fine. As I started developing a little code I got to a point I
> wanted a link back to the entry of the site, I thought
>
> <a href="/index.jsp">Back to Top</a>
>
> would do the job. But this link pointed to
>
> http://localhost:8080/my_stuff/servlet/index.jsp
>
> I was confused so to simplify things I went back to index.jsp and put a
> link to itself in the file. When you mouse over the link, the address it
> point to is
>
> http://localhost:8080/index.jsp
>
> Shouldn't Tomcat be prepending
>
> http://localhost:8080/my_stuff
>
> onto any link I specify like this
>
> <a href="/somefile.jsp">My Link</a>
>
> I'm playing around with what's called a model 2 architecture where a jsp
> page calls a servlet which does some data processing and then forwards the
> request to another jsp page and I'm not having any trouble with path's when
> I forward the request, just with links in the jsp pages.
>
> what's really maddening is that in playing around with this I've seen it
> work correctly and seen it fail. Obviously I'm doing something boneheaded,
> any ideas??
>
> Dave
>
>
>
>
>
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
--
Ing.Mauro Daniel Ardolino
Departamento de Desarrollo y Servicios
Altersoft
Billinghurst 1599 - Piso 9
C1425DTE - Capital Federal
Tel/Fax: 4821-3376 / 4822-8759
mailto: mauro@altersoft.com.ar
website: http://www.altersoft.com.ar
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>