| Summary: | jst.jsp - TLD files not detected in jar file within defined user library that is on project classpath | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [WebTools] WTP Source Editing | Reporter: | MG <java97301> | ||||||||
| Component: | jst.jsp | Assignee: | Nick Sandonato <nsand.dev> | ||||||||
| Status: | RESOLVED FIXED | QA Contact: | Nick Sandonato <nsand.dev> | ||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | nsand.dev, Olivier_Thomann, thatnitind | ||||||||
| Version: | 3.2.3 | Flags: | nsand.dev:
review-
|
||||||||
| Target Milestone: | 3.3 M6 | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Windows XP | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
|
Description
MG
According to jsp spec 8.4.1 tag files can be placed either under /META-INF/tags/ directory or in jar file installed in /WEB-INF/lib/ . There is no need to include lib folder to cp.Bug 229760 was fixed recently to take care of jar installed in /WEB-INF/lib/. (In reply to comment #1) > According to jsp spec 8.4.1 tag files can be placed either under > /META-INF/tags/ directory or in jar file installed in /WEB-INF/lib/ . There is > no need to include lib folder to cp.Bug 229760 was fixed recently to take care > of jar installed in /WEB-INF/lib/. Utility projects in WTP may or may not deposit jars into the WEB-INF/lib folder at development time, so we've instead just included everything in the Java Build Path (as long as it's "exported") to mimic the runtime visiblity. It also makes it trivial to use the taglib support in plain Java projects where the JRE and Servlet libraries have been manually configured, which is surprisingly common (this is one reason why the FacetModuleCore abstraction exists). Javier, are the jars in your User Library in the workspace? Rakesh, I think org.eclipse.jst.jsp.core.taglib.ProjectDescription#indexClasspath(IClasspathEntry)has an implicit assumption that they are, so if they're not, they'd be skipped. I'd say yes as the workspace encompasses a set of projects within eclipse and the project using the user library on the build path is within this workspace. The user library is defined within the workspace and is on the java build path of the project within the workspace. So if I right click my project, properties, choose java build path in the left menu and then the libraries tab, the user library is listed here. As a workaround I've just created a lib-build folder in my project and put the one library from the user libraries that contains the taglibraries into this folder and into my java build path. Looks like my initial comments were off on this. In my project it appears that the tag library completion does not work if my jsp is within /webapps/links/myjsp.jsp but if I move the links folder to be a direct sibling of the project then the tag library completion works. <%@ taglib uri="/myTags" prefix="myTags"%> /myTags is found in a .jar file within the user library which is on the build path. Any ideas? The interesting thing is that if I use "ObjectWeb Lomboz for JavaEE Development Version: 3.3" The tag library completion works fine where ever. If I use eclipse helios " Eclipse Java EE IDE for Web Developers. Version: Helios Service Release 1 Build id: 20100917-0705 " Then it only seems to work if the jsp is in a folder 1 level down from the project root. (In reply to comment #4) > Looks like my initial comments were off on this. > > In my project it appears that the tag library completion does not work if my > jsp is within /webapps/links/myjsp.jsp but if I move the links folder to be a > direct sibling of the project then the tag library completion works. > > <%@ taglib uri="/myTags" prefix="myTags"%> > > /myTags is found in a .jar file within the user library which is on the build > path. > > Any ideas? I don't understand "direct sibling"? That would have to be another project, right? What kind of project is it when working within Helios? And where are the *jars* themselves, in a project in the workspace or elsewhere? Is it possible to attach test project or give project structure?I created DynamicProject, and inside its WebContent i created a jsp. I created another project(simple project) , created a directory and put jar inside this directory.I then added this jar to first project's classpath.It was able to detect jar file. Looks like the use case is more restrictive than I thought. It seems that this might be limited to jsps that are in your project in a folder called webapp. Outside this folder the jsp taglibrary completion work but inside only the java code completion within the jsp works. I can create a sample project if this doesn't work for you. Created attachment 183446 [details]
sample project
This is the sample project i used for testing.I could use content assist at /webapps/links/some.jsp also .Let me know if i missed something.Please attach your test project if your project structure is different.
Created attachment 183508 [details]
the project with jsp: syntax not completing in webapps folder
Hopefully this helps you reproduce.
It took me a while to break your project. There were two requirements output build path /webapps/WEB-INF/classes and the web.xml file - at least from what I could tell these seemed to both be required for it not to work. (In reply to comment #11) > It took me a while to break your project. There were two requirements output > build path /webapps/WEB-INF/classes and the web.xml file - at least from what I > could tell these seemed to both be required for it not to work. You are seeing this behavior due to this text segment in your web.xml '<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">' While parsing this we conclude that jsp version is 1.1 , since this dtd is for J2EE 1.2 version. So it looks like 'Works as Designed' to me.Let me know if i missed something.
So what you are saying is that jsp 1.1 didn't support custom tag libraries and this is why it won't code complete the mynewtag:whatever? That would surprise me. I thought custom tag libraries have been around as long as jsp.
> > It took me a while to break your project. There were two requirements output
> > build path /webapps/WEB-INF/classes and the web.xml file - at least from what I
> > could tell these seemed to both be required for it not to work.
>
> You are seeing this behavior due to this text segment in your web.xml
> '<!DOCTYPE web-app
> PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
> "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">'
> While parsing this we conclude that jsp version is 1.1 , since this dtd is for
> J2EE 1.2 version.
> So it looks like 'Works as Designed' to me.Let me know if i missed something.
Created attachment 183822 [details]
possible patch.
I went through jsp spec 1.1 and 1.2.I couldn't figure out(by reading spec) why we allowed classpath entries only for jsp 1.2 or greater.I have allowed to it for version 1.1 also.Let me know if i missed some portion of spec.
(In reply to comment #14) > Created an attachment (id=183822) [details] > possible patch. > > I went through jsp spec 1.1 and 1.2.I couldn't figure out(by reading spec) why > we allowed classpath entries only for jsp 1.2 or greater.I have allowed to it > for version 1.1 also.Let me know if i missed some portion of spec. JSP 1.1 only allowed TLDs to referred to by pointing to the actual .tld file or to a .jar file containing a META-INF/taglib.tld, or some mapping in the web.xml pointing to one of those (section 5.3.1). Only resources physically in the web application were usable. This 1.1 restriction is why we index both the files themselves and entries on the Java Build Path into separate collections. Interesting. Alright I accept that this is not a bug. Could we do an error message improvement. The current error just says "Can not find the tag library descriptor for "http://mycompany.com/tags". Try increasing the version of the Dynamic Web Module project facet." Perhaps you could check if this is because the dtd spec'd in the web.xml is 2.2 and you are assuming jsp 1.1 and say something like "The web_app spec 2.2 referenced in the web.xml file does not allow TLDs to be referred to in the manner you've used." I think that would be much more helpful. While the reason this not a bug is buried in the spec it took a lot of time to track down the exact reason this was not working. Thanks for the persistence on tracking down the issue for me ! Really now that I know I'll never have a problem with it. It will just be anyone else who happens to import or use examples to start that are a little dated. I've updated the error message to indicate that the method of reference may not be supported for the current JSP version. Thanks! |