Link to home
Start Free TrialLog in
Avatar of mbf-it
mbf-it

asked on

taglib directive does not exist or TLD is not found

I am using Java 1.4.2 in eclipse and I am getting the following errors with my .jsp pages:

taglib directive for "html" does not exist or TLD is not found
taglib directive for "bean" does not exist or TLD is not found
taglib directive for "logic" does not exist or TLD is not found

The program still works, but for some reason, eclipse is not recognising the lines of code:
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>

I'm not sure why these errors are popping up????

Cheers
Avatar of mnrz
mnrz

hi
you have to define it in deployment descriptor (web.xml)

<taglib>
    <taglib-uri>/tags/struts-bean</taglib-uri>
    <taglib-location>/WEB-INF/mytaglibs/</taglib-location>
</taglib>
Avatar of mbf-it

ASKER

My web.xml file has the following:

-------------------------------------------------------------

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app PUBLIC
      "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
      "http://java.sun.com/dtd/web-app_2_3.dtd">


<web-app>
  <display-name>Struts Blank Application</display-name>
 
 
  <!--
        - Location of the XML file that defines the root application context.
        - Applied by ContextLoaderServlet.
            -
            - Can include "/WEB-INF/dataAccessContext-local.xml" for a single-database
            - context, or "/WEB-INF/dataAccessContext-jta.xml" for a two-database context.
        -->
      <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
                  /WEB-INF/greenbook-data.xml
            </param-value>
      </context-param>
 
  <!--
        - Loads the root application context of this web app at startup,
        - by default from "/WEB-INF/applicationContext.xml".
            - Note that you need to fall back to Spring's ContextLoaderServlet for
            - J2EE servers that do not follow the Servlet 2.4 initialization order.
            -
        - Use WebApplicationContextUtils.getWebApplicationContext(servletContext)
        - to access it anywhere in the web application, outside of the framework.
        -
        - The root context is the parent of all servlet-specific contexts.
        - This means that its beans are automatically available in these child contexts,
        - both for getBean(name) calls and (external) bean references.
        -->
      <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
      </listener>
 
  <!-- Standard Action Servlet Configuration (with debugging) -->
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>2</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>


  <!-- Standard Action Servlet Mapping -->
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>


  <!-- The Usual Welcome File List -->
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

  <!-- Application Tag Library Descriptor -->
  <taglib>
    <taglib-uri>/tags/app</taglib-uri>
    <taglib-location>/WEB-INF/app.tld</taglib-location>
  </taglib>

  <!-- Struts Tag Library Descriptors -->
  <taglib>
    <taglib-uri>/tags/struts-bean</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>

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

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

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

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

</web-app>

-------------------------------------------------------------

Is that what you mean?  Shouldn't that work???
yes, it's ok.
check whether the tld files exist on your application server under the WEB-INF directory.

would you show the full stack trace exception?
Avatar of mbf-it

ASKER

yes - all the files are there...

what do you mean by full stack trace exception???  how do I show that???
I meant the whole exception message.
for example if you are using Tomcat, you can copy the exception message from its console.
Avatar of mbf-it

ASKER

as i said, the program works so there is no error message so there is no other error message.

...i think it's a problem with eclipse...?
ASKER CERTIFIED SOLUTION
Avatar of mnrz
mnrz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial