Yet Another JSP Issue

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Yet Another JSP Issue

Tony Thompson
Well, if the other issue I reported about mapped JSPs is not confusing
enough, this is even better.  I will begin by attempting to outline what
I am doing in my application.  I have a JSP that resides in a web
application that attempts to get XML fragments out of other web
applications so it can display a menu in a browser.  So, the web
applications that are called must have a servlet mapping for the URL
/BuildMenu.  This is generally mapped to a JSP so that the menu content
can be generated on the fly.

It looks roughly like this:

    <c:import context="/app1" url="/BuildMenu"/>
    <c:import context="/app2" url="/BuildMenu"/>
    <c:import context="/app3" url="/BuildMenu"/>

So, internally, the <c:import> tag uses the RequestDispatcher to call
into each of the other applications.  In each application, there is a
servlet definition and mapping like this:


When the JSP is mapped like this, it causes this case to happen in

            // Handle aliased path
            if (_forcedPath!=null)

This causes javax.servlet.include.servlet_path to be set to /menu.jsp
instead of /BuildMenu.  The issue is, Jasper uses this attribute at the
start of its JspServlet.service() method and, when set incorrectly, it
causes exceptions:

java.lang.StringIndexOutOfBoundsException: String index out of range:
        at java.lang.String.substring(
        at java.lang.String.substring(

I didn't send the rest of the stack trace because the line numbers in
the Jetty code would be wrong because I have been messing with things
trying to figure this out.  If I change the servlet mapping to a
<servlet-class> instead of a <jsp-file>, it works fine.

I have no idea why this is happening and I am willing to provide more
information to anyone who is able to tackle this.  I am using Jetty


This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more.
Jetty-support mailing list
[hidden email]