- This topic has 7 replies, 3 voices, and was last updated 18 years, 5 months ago by Riyad Kalla.
-
AuthorPosts
-
Erik ReuterMemberIf I develop a custom taglib (e.g. a JSF component lib) and place it in a separate Java project, where the META-INF folder contains both the faces-config.xml and taglib.tld I can’t find a way to make this available for use in JSP files without actually copying the taglib.tld file into the WAR project.
I was wondring if you could extend the dependent Java projects so that “virtual” jars are created at development time so that code assist + jsp validation would work in this situation?
Or make the JSP tooling aware that there might be dependent Java projects which are taglib projects and make this work?
Regards
Erik Reuter
Riyad KallaMemberErik,
I will file this for investigation, as you found, currently the resolution applies to classes only.
Riyad KallaMemberErik,
It seems that if you setup your META-INF dir in the root of your /src dir of the dependent Java project, and then use a packaged deployment for the dependent project (JAR it up) this behavior should already be supported.
Erik ReuterMemberHaven’t gotten around to test this until now, sorry for the delay…
I can’t seem to make this work, the JSP classic editor / JSP designer reports that they cannot load the taglib.tld from the jar’ed taglib.
Could you provide a step-by-step instruction for me to do this? It would be a great help!
Regards
Erik
Hani NaguibMemberHas this been resolved? I am also trying to achive the same thing.
Riyad KallaMemberWhat needs to be resolved? I gave instructions on how to achieve this… is this not working for you? In which case, please provide more information for me to work with to help you.
Hani NaguibMemberOk, let me explain my situation and the problem I am having.
I have a java project called mytaglib, this contains the source for my tag library. In the
src directory under this project I have a file src/META-INF/taglib.tld (which contains the
tld for my taglib).In my workspace I also have a Myeclipse Web project (called mywebapp), which uses mytaglib
(ie the mytaglib project is in the build path of mywebapp).I dont want to copy the tld of mytaglib into the mywebapp project since currently changes frequently.
With the above set up I can get the mywebapp project to correctly deploy by specifying that
dependent projects (in this case mytaglib) be jarred and placed into the /WEB-INF/lib directory.
In this case I can reference my taglib my placing the following in /WEB-INF/web.xml<taglib>
<taglib-uri>http://mycompany/mytaglib/taglib.tld</taglib-uri>
<taglib-location>/WEB-INF/lib/mytaglib.jar</taglib-location>
</taglib>and from my jsp pages
<%@ taglib uri=”http://mycompany/mytaglib/taglib.tld” prefix=”m” %>
NOTE: The above works fine, the deployed application works.
BUT: I get an error (due to validation) that says:
Unable to read TLD: “META-INF/taglib.tld” from JAR file “file:C:/Programming/workspaces/t6/mywebapp/WebRoot/WEB-INF/lib/mytaglib.jar”: java.util.zip.ZipException: The system cannot find the fileThe reason for this error is that the file MyEclipse is looking for “C:/Programming/workspaces/t6/mywebapp/WebRoot/WEB-INF/lib/mytaglib.jar” only gets created when I deploy the project and
then it is only placed in the deployed directory (ie the webapps/mywebapp/WEB-INF/lib directory under Tomcat).I can get rid of this error by making a copy of my tld, placing it under mywebapp/WEB-INF/tlds and modifying web.xml to point to that instead of the one inside the mytaglib.jar
Hope this is clear.
It is not a critical problem since as the code for my tag library becomes more stable I will not need to copy the tld accross projects very often.
But during the development of mytaglib project it is a bit annoying.Thanks for the quick reply.
Hani
Riyad KallaMemberHani,
After reading your well-detailed post, you are doing exactly what you need to do to work around the fact that the JAR doesn’t exist until deploy time. Iknow it’s a bit annoying needing to dupe the TLD in your web project during development, but until the taglib settles down and can be JARed in the dependent project (at which point the TLD will be resolved automatically from the JAR) you will need to do that.Sorry I can’t provide a workaround.
-
AuthorPosts