Christian, Not sure if you're still wrestling with this, but I just wanted to post to say that I've been meaning to slap a little test app together as a sanity check and I'll post back when I get the chance to code & run it...
Quoting Christian Taylor <[EMAIL PROTECTED]>: > Hi, > > I'm new to this list, but far from a newbie when it comes to servlets, > JSP, JSTL and Tomcat. I've spent hours trying to debug this problem, > searched the net and mailing lists and haven't been able to find a > solution. Here is my situation: > > My application has many pages that use <c:import> to include a common > header. The header takes a "title" parameter. I've seen other people > doing this in the archives of this list. My code looks like this: > > <c:import url="/include/header.jsp"> > <c:param name="title" value="Title of the page"/> > </c:import> > > header.jsp uses the title for the <title> tag as well as to display to > the user at the top of the page. > > These pages can be accessed in two different ways: > > 1) By a normal user of the application through a web browser > 2) From a servlet that uses RequestDispatchers to capture some pages > to save as files that can be viewed offline. > > The problem I'm having is with #2. The title parameter does NOT get > passed to header.jsp, and neither do request-scoped variables. > > My "offline servlet" creates request and response wrappers to pass to > the RequestDispatcher's include() method. The wrapped request overrides > the relevent "parameter" methods (getParameter(), getParameterMap(), > etc.) and provides setter methods so I can pass parameters to the pages > to be "captured". It also defines a request-scoped variable called > _OfflineBackup which the pages can use to detect how they are being > accessed (some paths, etc. need to be different if the page is to work > offline). > > My response wrapper is a typical "override getOutputStream() and > getWriter() to capture the output" type of thing. > > I've looked through the Tomcat and taglibs-standard sources and can't > find anything that would help. The code for the <c:import> tag appears > to build a query string from the <c:param> tags and pass it as part of > the URL to the RequestDispatcher it creates, but Tomcat's > ApplicationDispatcher implementation doesn't seem to do anything with > it, from what I can see in the source (but I'm not a Tomcat developer > and am not that familiar with the source). The parameters in the wrapped > request can be accessed from header.jsp, but not the actual parameters > passed to header.jsp using <c:param>. > > This all leads me to my real question... why does my 'title' parameter > work fine when I simply view the pages normally in a browser, but not > when I use a RequestDispatcher and my wrapped request/response? The > problem appears to be that Tomcat doesn't look at the parameters in the > path when getRequestDispatcher(path) is called, which makes me wonder > why the <c:param> tag ever works at all (but as I said, I'm not a Tomcat > developer and have limited knowledge of the source so I could be wrong > here, this is just what I've found from digging through the sources). My > wrappers seem to be working fine, and the import works properly when > viewing the page in a browser. > > I hope I explained everything well enough and I apologize for this being > a bit long. I'm using Tomcat 5.0.28 and taglibs-standard 1.1.1. This is > a servlet 2.4/jsp 2.0 application. Thanks in advance to anyone who might > be able to help me here! > > Christian -- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]