Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349796 - Tag files not resolved correctly from JAR project in workspace
Summary: Tag files not resolved correctly from JAR project in workspace
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: jst.jsp (show other bugs)
Version: 3.2.4   Edit
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Target Milestone: 3.3.1   Edit
Assignee: Nick Sandonato CLA
QA Contact: Nick Sandonato CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-20 05:47 EDT by adros CLA
Modified: 2012-09-19 16:45 EDT (History)
3 users (show)

See Also:
thatnitind: review+


Attachments
Sample projects with bug demonstration (9.48 KB, application/x-zip-compressed)
2011-06-21 02:16 EDT, adros CLA
no flags Details
Demonstration of similar problem when developing composed tag files in Java project (5.34 KB, application/x-zip-compressed)
2011-06-22 05:22 EDT, adros CLA
no flags Details
patch (6.48 KB, patch)
2011-06-23 15:04 EDT, Nick Sandonato CLA
no flags Details | Diff
Maven Test Project (5.66 KB, application/zip)
2011-08-23 06:28 EDT, Aliaksei Lahachou CLA
no flags Details
Standalone test project that shows the issue (2.32 KB, application/x-zip-compressed)
2012-09-19 11:07 EDT, Carsten Leue CLA
no flags Details
Screenshot that displays the warning message (13.59 KB, image/png)
2012-09-19 11:08 EDT, Carsten Leue CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description adros CLA 2011-06-20 05:47:45 EDT
Build Identifier: 3.6.2

When I create a Tag file in a java project (then register this tag file in TLD) and then I use this tag file in a JSP page in a webapp project that is depended on created java project, I get a warning "The tag handler class for "x:tag" (null) was not found on the Java Build Path" and there is no autocomplete for tag attributes.

Reproducible: Always

Steps to Reproduce:
1. create a Tag file in a java project and register this tag file in TLD (as specified in JSP 2.1 specification). 
2. create a JSP page in a webapp project that is depended on this java project.
3. use the tag file from java project in created JSP page
Comment 1 adros CLA 2011-06-20 06:49:13 EDT
If the java project is packed as JAR and added to webAppLibraries, everything is correct.
Comment 2 Nick Sandonato CLA 2011-06-20 18:03:41 EDT
Thanks for your bug report. Right now, we're only checking the buildpath of any projects dependencies. Since it's likely that your TLD and tag file are outside of the buildpath for that project, we miss them.

Would it be possible for you to share your example projects so that we make sure we account for your exact scenario?

Thanks.
Comment 3 adros CLA 2011-06-21 02:16:49 EDT
Created attachment 198307 [details]
Sample projects with bug demonstration
Comment 4 adros CLA 2011-06-22 05:22:19 EDT
Created attachment 198380 [details]
Demonstration of similar problem when developing composed tag files in Java project
Comment 5 adros CLA 2011-06-22 05:24:03 EDT
The same problem comes out when developing a tag file (in java project) that is composed from other tag files from the same project. See attachment 198380 [details].
Comment 6 Nick Sandonato CLA 2011-06-23 15:04:29 EDT
Created attachment 198492 [details]
patch

Seems like the main trouble point was resolving the tag file when the TLD was not within the web content root of a dynamic web project. This patch should tolerate that now.
Comment 7 Nick Sandonato CLA 2011-06-24 16:57:46 EDT
Code checked in for 3.3 maintenance.
Comment 8 Aliaksei Lahachou CLA 2011-08-23 06:19:52 EDT
Hello World!

This feature is important for us, hence I took some time to test the fix. I used Eclipse 3.7.0 and updated WTP from wtp-repo-M-3.3.1-20110818013442.zip.

Test projects attached to this bug seem to be working after import, but there are some oddities.

1. Import projects from attachment 198307 [details].
2. Open WebProject/WebContent/index.jsp - code assist works properly for t:table. You may add a new t:table and someAttr is displayed in the list of available attributes.
3. Add a new required attribute to TagProject/src/META-INF/tags/test.tag (for example, <%@ attribute name="test" required="true" %>).
4. Go back to index.jsp - code assist does not show new attribute.
5. Remove projects from workspace and import them again - now error is displayed (missing required attribute) and new attribute is displayed by code assist.
Comment 9 Aliaksei Lahachou CLA 2011-08-23 06:28:26 EDT
Created attachment 201988 [details]
Maven Test Project

I prepared another test project. The problem is that code assist shows tag from jar but does not show its attributes. This is a Maven project, import it as existing Maven project.

I used the following configuration: Eclipse 3.7.0, wtp-repo-M-3.3.1-20110818013442.zip, m2e 1.0.0, m2e-wtp 0.13.1.
Comment 10 adros CLA 2012-03-08 05:08:38 EST
I think that this issue is still not completely resolved, as Aliaksei Lahachou said, it is not working if TAG file is defined in maven project. I do not think that this is a maven issue.
Comment 11 Nitin Dahyabhai CLA 2012-03-08 13:30:01 EST
That doesn't make sense.  Let me put it this way: can it be reproduced *without* Maven and m2e being involved?
Comment 12 Carsten Leue CLA 2012-09-19 11:07:46 EDT
Created attachment 221251 [details]
Standalone test project that shows the issue

Standard java project that shows that the WTP JSP editor requires the implementation class of the tag and shows a warning if the class is missing.
Comment 13 Carsten Leue CLA 2012-09-19 11:08:50 EDT
Created attachment 221252 [details]
Screenshot that displays the warning message
Comment 14 Carsten Leue CLA 2012-09-19 11:11:11 EDT
I can also reproduce the issue, the JSP editor in WTP shows a warning if only the TLD is on the classpath but the implementation class of the tag is not. However for tooling purposes the TLD should be sufficient.

I've added a sample project (standard, not maven) and a screenshot for reference.

Version: Juno Release
Build id: 20120614-1722

Eclipse Java EE Developer Tools
Version: 3.4.0.v201107072300-7b7JIM0FSK2WM1PS9Ar7AKUz0TrWn
Build id: 20120518171617
Comment 15 Nitin Dahyabhai CLA 2012-09-19 16:45:38 EDT
(In reply to comment #14)
> However for tooling purposes the TLD should be sufficient.

Not always.  For tags in the TLD that specify a TagExtraInfo class, we require the class file to properly determine additional local Java variables that will ultimately be in the Servlet service method.  If it were specified, there should be a warning about it not being available as well.  Both of these warnings are controllable from the Errors/Warnings->Custom Actions section of the Web->JSP->Validation preference page.  Attachment 221251 [details] from comment 12 doesn't use a .tag file, so it is unrelated to the original problem.

Re-resolving.  The problems in comment 8 and comment 9 sound different from the original reported issue (problem refreshing what's known about the tag; does it help to close and reopen the JSP Editor?) and should be a separate bug report.