First, config info.  This is using Tomcat 3.2.1 with its own built-in Web 
server on W2K.  I've looked through the FAQ and mailing list archives and 
can't find an answer to this question (I can't find the question, either, 
which I think is kinda weird, but there you are...).

I have a web application set up in its own top-level context, let's say 
/myapp.  So I can refer to pages within that context with 
http://myserver/myapp/page.jsp.  That works fine as a URL provided in an 
HREF.  The problem comes when I forward to files within that context.  I 
use some static members stored in a bean to provide configurable mapping to 
components within that app.  So I'll have this:

public class MyBean
{
        public static String    kstrMyRootDir   = "/myapp";
        public static String    kstrMyComp1     = kstrMyRootDir + "/comp1";
        public static String    kstrMyComp2     = kstrMyRootDir + "/comp2";
        public static String    kstrMyComp3     = kstrMyRootDir + "/comp3";
}

Then I can do stuff like:

<jsp:forward page='<%= kstrMyComp1 + "/page.jsp" %>' />

This works fine using JRun 2.3.3.  This directive would forward the page to 
/myapp/comp1/page.jsp.  Now I'm trying to move this app to work on Tomcat 
and I don't get the same behavior.  Instead, the above directive tries to 
forward to /myapp/myapp/comp1/page.jsp.  This is bad.

So obviously Tomcat appends the context name onto forward directives.  This 
includes when I tear the call down and do it directly in code like this:

pageContext.forward (kstrMyComp1 + "/page.jsp");

The string arithmetic gives me the proper page and path, i.e. 
/myapp/comp1/page.jsp, so this happens somewhere that I can't directly 
affect through code.  Now, this seems stupid to me, since the fact that the 
path begins with '/' indicates that it should go to the server root, NOT 
the context root.  So:

* Is there a good explanation as to why this is done this way?  I know 
there's some restriction about switching from context to context, i.e. 
/app1 to /app2.  Is this an upshot of that restriction?

* Regardless of the explanation, good or not, is there any way to make this 
go away?  I don't want to have to retool my code to work with this if I can 
help it.  There will be a lot of forwards to fix and I expect that includes 
work the same way, although I haven't tested it yet.

Thanks for any info you may have on this!  It's driving me up a wall!
--
Rick Herrick
[EMAIL PROTECTED]
Nothing is amusing in zero gravity...


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to