facebook

How to include a jsp custom tag library (.tld)?

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #226156 Reply

    icg_amigon
    Member

    Eclipse Platform Version: 3.1.0
    MyEclipse_Enterprise_Workbench_v3.8.2

    I have recently installed eclipse and MyEclipse, and trying to use it to work on an existing web project that uses custom jsp tags. How do I configure the IDE so it knows where the tld file is and recognises the custom tags?

    #226171 Reply

    Riyad Kalla
    Member

    NOTE: I replied to your other thread that this setup won’t work (well) so you will run into lots of problems.

    As far as setting up taglibs, please see this entry: http://www.myeclipseide.com/FAQ+index-myfaq-yes-id_cat-31.html#251

    #226222 Reply

    quincy
    Member

    well, your FAQ entry is saying that specifying tld file paths in the uri attribute of a taglib directive is not allowed per the “web application spec from Sun”.
    It even goes as far as saying that “many people don’t quite understand what the purpose of the “uri” attribute in the <%@taglib %> tag is for”

    I think that you guys are among these people, because from the section JSP7.3.2 (in the JSP spec 2.0 and 1.2):

    ——–
    The following order of precedence applies (from highest to lowest) when
    building the taglib map (see the following sections for details):
    1. Taglib Map in web.xml
    2. Implicit Map Entries from TLDs
    TLDs in JAR files in WEB-INF/lib
    TLDs under WEB-INF
    3. Implicit Map Entries from the Container
    ——-

    So, specifying a tld file path (relative to the web app root) is definitely legal.

    Of course, let alone that *all* major app servers support this (convenient) usage which makes it a “standard” in some sense.

    #226225 Reply

    Riyad Kalla
    Member

    Quincy,
    I appreciate the corrections, I will reevaluate those FAQ entry and change it as necessary. Sorry for the misdirection.

    #226564 Reply

    I have the same problem. I’m using some JSP tags from http://www.common-controls.com, and the JSP editor tells me it doesn’t know the tag. But the same goes for Struts tag…
    Obviously, Tomcat does find the tags, otherwise my application wouldn’t work 😉 But how can I configure the JSP editor to look for the TLDs?

    #226566 Reply

    Riyad Kalla
    Member

    While this may not be correct (According to Quincy’s post) it almost always solves users problems with taglibs:
    http://www.myeclipseide.com/FAQ+index-myfaq-yes-id_cat-31.html#251

    So I would suggest giving it a try.

    #226567 Reply

    Well, for instance I have the following in my JSP:

    
    <%@ taglib uri="struts-html.tld" prefix="html" %> 
    

    but the following shows an error:

    
    <html:form action="editTreeGroup"> 
    

    In my web.xml the TLD is defined as follows:

    
        <taglib>
            <taglib-uri>struts-html.tld</taglib-uri>
            <taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>
        </taglib>
    

    and the TLD is in that location.

    Note that I’m not editing the JSP in a Struts project, this is plain Tomcat project.

    #226568 Reply

    Riyad Kalla
    Member

    Eric,
    This is all correct and should be recognized assuming that your project is atleast a Web Project (I don’t know what a Tomcat project is, do you have Lomboz or Sysdeo installed?). Right click on the project and go to project properties, you should see a MyEclipse-Web section of your properties if it is a web project. If you do have these properties then make sure that struts.jar is in your build path and then you can try rebuilding your project with Project > Clean (make sure automatic rebuild is enabled).

    #226754 Reply

    icg_amigon
    Member

    I have similar problem as Eric has. My newly installed Eclipse IDE does not recognise custom tags in my jsp pages. Could someone tell me what is wrong?

    I have checked my settings:

    Eclipse Platform Version: 3.1.0
    MyEclipse_Enterprise_Workbench_v3.8.2

    every jsp page has these two lines (the second one is a custom tag lib):

    <%@ taglib uri="struts-html.tld" prefix="html" %>
    <%@ taglib uri="weblog.tld" prefix="weblog" %>

    And in my web.xml (..\WEB-INF\web.xml):

     <taglib>
        <taglib-uri>struts-html.tld</taglib-uri>
        <taglib-location>/WEB-INF/lib/struts-html.tld</taglib-location>
      </taglib>
      <taglib>
        <taglib-uri>weblog.tld</taglib-uri>
        <taglib-location>/WEB-INF/weblog.tld</taglib-location>
      </taglib>
    

    And I have checked the respective .tld files exist at specified locations.

    I think it is recognised by Eclipse as a web project. As I clicked on MyEclipse on the menu bar, ‘Add WebProject Capabilities’ in the drop down menu is not active, whereas ‘Remove WebProject Capabilities’ is active.

    I have also checked the build path – as I clicked on Project on the menu bar, select ‘Properties’, then select ‘Java Build Path’ on the left pane, struts.jar exists under the Libraries tab.

    #226761 Reply

    Riyad Kalla
    Member

    Eclipse Platform Version: 3.1.0
    MyEclipse_Enterprise_Workbench_v3.8.2

    These are not compatible versions. If you need to be using Eclipse 3.1, then you must use Eclipse 3.1M4 (not M5) then go to our “Eclipse 3.1 Downloads” section and grab MyEclipse 3.8.4 BETA. If you can use Eclipse 3.0.1, then go to our “Eclipse 3.0.x Downloads” area and grab MyEclipse 3.8.4.

Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: How to include a jsp custom tag library (.tld)?

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