tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Query string parameters not included by RequestDispatcher on Tomcat 6.0.36
Date Thu, 19 Jun 2014 14:20:51 GMT
Hash: SHA256


On 6/19/14, 9:43 AM, Michael van Rooyen wrote:
> We've been running Tomcat 6.0.36 without issues for many months.
> Our pages have many components and are constructed using 
> getRequestDispacher("...").include(request, response) to pull the 
> components in.
> For the past few weeks, we've had a few instances where, in
> constructing a page, the parameters in the query string passed to 
> getRequestDispatcher(), are not being passed through to the
> components included.
> For example, if a browser submits the request /main.jsp?id=foo,
> then from that page, we include /product.jsp?id=bar, the
> product.jsp page should see the following parameters:
> id = [ bar, foo ]
> This happens almost all the time, but sporadically, we're getting
> just:
> id = [ foo ] instead.
> If the entry page was /main.jsp?cat=foobar, for example, then on 
> including /product.jsp?id=bar, we should get:
> id = [ bar ], cat = [ foobar ]
> But instead, we sometimes get just:
> cat = [ foobar ]
> Here is an extract from our logs.  The first is just before the
> call the getRequestDispatcher().include(), and shows the URI.
> 19 Jun 2014 2:58:04 PM org.apache.catalina.core.ApplicationContext
> log INFO: Trace @ 2014-06-19 14:58:04.808 [system: TP-Processor7] 
> /full/include/view/generic/smallfeature.jsp?id=25951215082928&cached=true
> And then the smallfeature.jsp logs the contents of the
> parameterMap directly thereafter:
> 19 Jun 2014 2:58:04 PM org.apache.catalina.core.ApplicationContext
> log INFO: Trace @ 2014-06-19 14:58:04.81 
> [993BE7ADFD65B94F2A62E85B64B3B8A2/null: TP-Processor7] Parameters:
> cat = lcu; page = browse; web.tags.Log.doStartTag(
> You can see the id and cached parameters are missing, and the
> parameters that are available are actually those from the main
> page.  Has anyone experienced this before, or know what may cause
> it?

I think there is a hole in the spec, here, because Servlet Spec 3.0,
section 9.1.1 states:

Parameters specified in the query string used to create the
RequestDispatcher take precedence over other parameters of the same
name passed to the included servlet. The parameters associated with a
RequestDispatcher are scoped to apply only for the duration of the
include or forward call.

The term "take precedence" could be interpreted as "overriding
completely" (Tomcat's implementation) or "appending" (your
expectation), and I think I would agree with the current
implementation Tomcat appears to have: the "id" parameter in your
included query string completely replaces the "id" parameter that came
from the original request.

Short of a clarification of the Servlet spec, you are going to have to
do something else in order to fix this problem. Might I recommend the
use of a request /attribute/ instead of a query string parameter to
pass information from one resource to another for inclusion?

- -chris
Version: GnuPG v1
Comment: GPGTools -
Comment: Using GnuPG with Thunderbird -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message