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
Java

Avatar of undefined
Last Comment
mnrz
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
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???
Avatar of mnrz
mnrz

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
mbf-it

ASKER

yes - all the files are there...

what do you mean by full stack trace exception???  how do I show that???
Avatar of mnrz
mnrz

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

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Java
Java

Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.

102K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo