facebook

Developing custom taglibs

  1. MyEclipse IDE
  2.  > 
  3. Feature Requests
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #232413 Reply

    Erik Reuter
    Member

    If 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

    #232435 Reply

    Riyad Kalla
    Member

    Erik,
    I will file this for investigation, as you found, currently the resolution applies to classes only.

    #232491 Reply

    Riyad Kalla
    Member

    Erik,
    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.

    #236572 Reply

    Erik Reuter
    Member

    Haven’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

    #253760 Reply

    Hani Naguib
    Member

    Has this been resolved? I am also trying to achive the same thing.

    #253762 Reply

    Riyad Kalla
    Member

    What 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.

    #253763 Reply

    Hani Naguib
    Member

    Ok, 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&gt;
    <taglib-location>/WEB-INF/lib/mytaglib.jar</taglib-location>
    </taglib>

    and from my jsp pages

    <%@ taglib uri=”http://mycompany/mytaglib/taglib.tld&#8221; 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 file

    The 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

    #253766 Reply

    Riyad Kalla
    Member

    Hani,
    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.

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Developing custom taglibs

You must be logged in to post in the forum log in