Bug 47318

Summary: Tomcat 6.0.20 does not include imports from included JSP
Product: Tomcat 6 Reporter: fitness_mania
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Severity: regression CC: damien
Priority: P2    
Version: unspecified   
Target Milestone: default   
Hardware: PC   
OS: Linux   
Attachments: include-prelude sample
webapp with tag files fail
Patch for jasper

Description fitness_mania 2009-06-04 19:21:41 UTC
Tomcat 6.0.20 does not include imports from included JSP, i.e.,
- JSP A includes JSP B.
- JSP B has some page imports

Result: JSP A is not able to see page imports imported in JSP B - the page imports imported in JSP B are not imported on JSP A generated class file.

Expected Result: JSP A is able to see page imports imported in JSP B

This worked in Tomcat 6.0.18.
Comment 1 Tim Funk 2009-06-05 04:32:53 UTC
please attach an example which reproduces this situation. I was unable to reproduce in a very simplistic setting.
Comment 2 fitness_mania 2009-06-05 08:46:05 UTC
Created attachment 23763 [details]
include-prelude sample

I forgot to mention that this happened when using JSP include-prelude. I did not try include-coda though.

I have attached a sample.
Comment 3 Tim Funk 2009-06-05 11:53:30 UTC
It seems like this might be the culprit:


This does look a little serious since its convenient to stick directives into a include-prelude so that all (or a group) of files can all get the same directives.

Also moving status back to new - since the attached patch does reproduce the issue.
Comment 4 Mark Thomas 2009-06-05 13:59:28 UTC
I'll take a look.
Comment 5 Mark Thomas 2009-06-05 16:49:32 UTC
Yep, that patch was the culprit although a little indirectly.

It has been fixed in trunk and the patch proposed for 6.0.x. I've also added it to the 5.5.x back port
Comment 6 Tim Funk 2009-06-08 06:07:38 UTC
Created attachment 23775 [details]
webapp with tag files fail

The same war file as previous attached with the new use case where tag file fail

Now fails with
javax.servlet.error.exception: java.lang.RuntimeException: org.apache.jasper.JasperException: ...  <%@ page directive cannot be used in a tag file
Comment 7 Tim Funk 2009-06-09 10:08:14 UTC
Created attachment 23781 [details]
Patch for jasper 

Here is a patch derived from 6.0.x [https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk ]

Changed files are 
 - java/org/apache/jasper/compiler/ParserController.java
 - java/org/apache/jasper/compiler/Compiler.java

It works on both test cases attached to the bug as well as some other code I have locally. Placing here instead of committing to trunk since this is my first dive into jasper.
Comment 8 Mark Thomas 2009-06-10 05:33:15 UTC
Better fix is now in trunk and proposed for 6.0.x. I went for a patch that kept the changes in parser.
Comment 9 Mark Thomas 2009-06-12 15:43:47 UTC
This has been fixed in 6.0.x and will be included in 6.0.21 onwards.
Comment 10 Mark Thomas 2009-07-02 05:02:54 UTC
*** Bug 47466 has been marked as a duplicate of this bug. ***