tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Weiss <swe...@aamc.org>
Subject Re: Pb with session
Date Fri, 20 Oct 2000 02:04:22 GMT
Kitching Simon wrote:
> 
>         [Kitching Simon]
>         Hmm, yes I see.
> 
>         If a browser requests a URL, and gets back a page containing
>         relative paths in it (eg to jsp files, or anchors/links), then the
>         browser is going to resolve those relative paths into absolute
>         paths before issuing a request to the web server; the browser
>         will use the *original* URL to resolve these relative paths with,
>         because it doesn't know that the original URL actually did an
>         internal forward operation.
> 
>         This is not too bad if a jsp is called via only one controlling
>         servlet, because all urls in the jsp can be set to be relative
>         to the calling servlet. But if a jsp can be called from multiple
>         controlling servlets, it has a problem.
> 
>         Is there a method that returns the original URL that the
>         calling browser requested, even if the request has been
>         forwarded? If so, then everywhere you output a path in
>         a jsp, you could call a function which converts from
>         relative-to-jsp into relative-to-original-url. However, this
>         really isn't a nice solution.
> 
>         This kind of thing is going to occur all the time when using the
>         MVC approach for designing websites. I wonder how STRUTS
>         solves this problem?

I'm not quite sure that I follow the problem being described, but I'm
using the MVC pattern without problems. If you want to display a link in
a JSP which is displayed as a result of a forward from a controller
servlet, you can use something like this:

<%= request.getContextPath() + "/servlet/myServlet" %> or
<%= request.getContextPath() + "/jsp/foo.jsp" %>

-- 
Steve Weiss      Association of American Medical Colleges
(202)828-0428    mailto:sweiss@aamc.org    http://www.aamc.org

Mime
View raw message