Tagdir Vs uri (in jsp taglib directive).

Hi
I am cofused between tagdir and uri used in taglib directive.
Kindly explain when to use a tagdir and when to use a uri.
examples :
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib tagdir="/WEB-INF/tags" prefix="myTags" %>
Thanks.

Hi
I am cofused between tagdir and uri used in taglib directive.
Kindly explain when to use a tagdir and when to use a uri.
examples :
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib tagdir="/WEB-INF/tags" prefix="myTags" %>
Thanks.

Similar Messages

  • How Do I Specify uri in JSP taglib Directive to Point to the Jar File

    I put the trail-taglib-0.2.jar file in the MyApplication/WEB-INF/lib directory.
    Because the .tld is included in the trail-taglib-0.2.jar, I added the following In the MyApplication/WEB-INF/web.xml file:
    < filter >
      < filter-name > trailFilter < /filter-name >
      < filter-class > org.osjava.taglib.trail.OriginalRequestFilter < /filter-class >
    < /filter >
    < filter-mapping >
      < filter-name > trailFilter < /filter-name >
      < url-pattern > *.do < url-pattern >
    < filter-mapping > How do I specify the uri in my JSP @taglib to point to the jar file? I think I did not get the path right:
    < %@ taglib prefix="trail" uri="trail-taglib-0.2" % >

    Your advices have been very good. Problems get solved one at a time.
    1. Now, the taglib.tld in the WEB-INF directory can be found; however, another problem occurred: XML parsing error on file /WEB-INF/taglib.tld: (line 11, col 17): Element type "display-name" must be declared.
    2. no matter where I insert the filter and its mapping in the web.xml file,
      <filter>
       <filter-name>trailFilter</filter-name>
       <filter-class>org.osjava.taglib.trail.OriginalRequestFilter</filter-class>
      </filter>
      <filter-mapping>
       <filter-name>trailFilter</filter-name>
       <url-pattern>*.do</url-pattern>
      </filter-mapping>The server cannot find the Struts tag libraries. If I remove the filter tag and its mapping, the server does not complain anymore. I checked the DTD, the filter tag and its mapping tag should be before the servlet tag and servlet mapping tag. But, it does not work.
    Here is the taglib.tld:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
    <taglib>
      <tlibversion>1.0</tlibversion>
      <jspversion>2.0</jspversion>
      <shortname>trail</shortname>
      <uri>http://www.osjava.org/taglibs/trail-1.0</uri>
      <info>Breadcrumbs in a taglib. </info>
      <display-name>Trail Taglib</display-name>
      <description>The Trail taglib maintains a dynamic trail of pages that the user has hit and allows a normalized version of that trail to be shown as a breadcrumbs list. </description>
      <tag>
        <name>list</name>
        <tagclass>org.osjava.taglib.trail.ListTag</tagclass>
        <bodycontent>JSP</bodycontent>
        <display-name>Trail List</display-name>
        <description>ListTag is used to display the trail, either the whole trail or more likely the normalized version. </description>
      <attribute>
          <name>var</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
          <description>Store the trail text in a variable. This will probably change to store the actual trail list and not the text. </description>
        </attribute>
        <attribute>
          <name>delimiter</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
          <description>The delimiter to use between trail items. It defaults to -> and at some point an image will be useable instead. </description>
        </attribute>
        <attribute>
          <name>type</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
          <description>The type of list to show. The default is 'normalized', while any other type specified will result in 'full'. </description>
        </attribute>
      </tag>
      <tag>
        <name>push</name>
        <tagclass>org.osjava.taglib.trail.PushTag</tagclass>
        <bodycontent>JSP</bodycontent>
        <display-name>Trail Formation</display-name>
        <description>Place a page on the trail. </description>
        <attribute>
          <name>label</name>
          <required>true</required>
          <rtexprvalue>true</rtexprvalue>
          <description>The text to use when placing the page on the trail. This is what will be displayed to the user in the List tag. </description>
        </attribute>
        <attribute>
          <name>url</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
          <description>Usually the url in question will be figured out by the taglib, however you may override it with this attribute. </description>
        </attribute>
      </tag>
    </taglib>

  • Jsp taglibs in include files not detected, throws errors, no code insight

    I have a jsp which is included in all the other jsp. it looks something like this
    taglibs.jsp
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
    <%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
    <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
    test.jsp
    <%@ include file="/jsp/menu/taglibs.jsp"%>
    <html>
         <head>
              <title>Tours</title>
         </head>
         <body>
    <form:form commandName="testCommand">
                   <form:hidden path="tour.firstname" id="tour.firstname" />
    and so on.
    I am having 2 problems
    1. the jsp editor show errors all over the place saying
    element path not expected
    element commandName not expected etc.
    2. no code insights.
    but if i include the taglib def in test.jsp it dosn't show any error and also provides code insights. but seldom do people include all taglibs in all jsps.
    is there a way for Jdeveloper to show code insights in jsp pages which includes a jsp or like xml schemas could be added at some place(tools-pref-xml schemas) and when used anywhere, would provide code insights.

    am not sure, try with this
    <jsp:include   .../>

  • Getting 'taglib directive for "f" does not exist or TLD is not found'

    Hi,
    I'm using Eclipse 3.4 and when I open my JSF page in Eclipse, I'm getting red "x"'s next to my JSF directives. For example,
    <f:view>
    has a red "x" along the left margin and when I roll over it, it gives me the error, 'taglib directive for "f" does not exist or TLD is not found.' This is odd because I have the appropriate directives, including
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    at the top of my page. Strangely, the "<%@" portion appears in red. Does anyone know how I can get Eclipse to recognize the listed directives?
    Thanks, - Dave

    Hi, I went to the link
    http://java.sun.com/javaee/javaserverfaces/download.html
    but following the steps only got to a place where I could download JavaServer(TM) Faces Specification Maintainance Release -- jsf-1_1-mr-spec.pdf. I did not see anywhere on here where I could download the actual jsf-api.jar or jsf-impl.jar files.
    Any further clarification you can provide is appreciated, - Dave

  • JSP Taglib for RSS

    Just wondering if anyone else is having better luck - been working thru:
    http://developer.java.sun.com/developer/technicalArticles/javaserverpages/rss_utilities/
    Each time I try and parse an RSS file I get the following trace:
    <rss>
    <channel>
    <title>
    </title>
    <link>
    </link>
    <description>
    </description>
    </channel>
    <item>
    INFO: items does not exist or method signature is incorrect
    java.lang.NoSuchMethodException
    at java.lang.Class.getMethod0(Native Method)
    at java.lang.Class.getMethod(Class.java:888)
    at com.sun.cnpi.rss.handlers.DefaultElementHandler.startElement DefaultElementHandler.java:91)
    at com.sun.cnpi.rss.handlers.DocumentHandler.startElement(DocumentHandler.java:98)
    at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1477)
    ... rest of stack trace.
    This is tried with 5 or 6 different RSS feeds (0.91 and 2.0) and with both crimson and the latest xerces parsers (stacktrace is the same apart from the parser specific parts - it's always in com.sun.cnpi.rss.handlers.DocumentHandler.startElement(DocumentHandler.java:98)
    It appears to be trying to call a method based on the fact that it has seen an items tag (which it hasn't - it's an item tag).
    The JSP:
    <%@ taglib uri="/rssutils.tld" prefix="rss" %>
    <rss:feed
    url="path-to-feed"
    feedId="intranetRT"/>
    <h2>"><rss:channelTitle feedId="intranetRT"/></a></h2>
    <rss:forEachItem feedId="intranetRT">
    <h3><a href="<rss:itemLink feedId="intranetRT"/>"><rss:itemTitle feedId="intranetRT"/></a></h3>
    <div class="item">
    <p><rss:itemDescription feedId="intranetRT"/></p>
    </div>
    </rss:forEachItem>
    Maybe of interest - all tried RSS streams work fine for various other RSS readers and return valid from 2 different validators.
    Hints anyone?

    I try using this tag library, and I get the following on my page:
    java.lang.ClassNotFoundException: com.cj.rss.objVariable
    as the root cause for this excemption:
    org.apache.jasper.JasperException: Failed to load or instantiate TagExtraInfo class: com.cj.rss.objVariable
    Do I have a bad "path" set up somewhere? Here's my code:
    <%@ taglib uri="/WEB-INF/lib/taglib.tld" prefix="c" %>
    <html>
    <head><title>Java Feed</title></head>
    <body>
    <%-- <jsp:useBean id="beanInstanceName" scope="session" class="beanPackage.BeanClassName" /> --%>
    <%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>
    <c:setFeed url="http://www2.theserverside.com/rss/theserverside-1.0.rdf" id="A"/>
    <p>Title:<c:getChannelTitle feedId="A"/>
    <p>Description:<c:getChannelDescription feedId="A"/>
    <c:forEachItem feedId="A">
    Link:<%=itemLink%>
    Title:<%=itemTitle%>
    Description:<%=itemDescription%>
    </c:forEachItem>
    </body>
    </html>
    It's pretty simple code, and I made sure that the library file (jar) and .tld file were in the /WEB-INF/lib directory, off of the "context" directory or "docroot". I guess I would have gotten a different error if they weren't there.
    Any thoughts as to why my server is having problems loading the object:
    com.cj.rss.objVariable
    It is in my rsstag.jar file. I confirmed it by opening it with WinZip. Here's the reference to it in the rssrag.tld file:
    <tag>
    <name>setFeed</name>
    <tagclass>com.cj.rss.setFeedTag</tagclass>
    <teiclass>com.cj.rss.objVariable</teiclass>
    <bodycontent>JSP</bodycontent>
    <info>parses rss feed</info>
    Any information would be greatly appreciated.

  • JSP Taglibs

    Hi,
    I try to use a taglib and get this Exception:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 4 in the jsp file: /Login.jsp
    Generated servlet error:
    C:\Programme\Apache Tomcat 4.0\work\localhost\testdemo\Login$jsp.java:59: Class org.apache.jsp.testTL not found.
    testTL jspxth_mytag_test_0 = new testTL();
    ^
    An error occurred at line: 4 in the jsp file: /Login.jsp
    Generated servlet error:
    C:\Programme\Apache Tomcat 4.0\work\localhost\testdemo\Login$jsp.java:59: Class org.apache.jsp.testTL not found.
    testTL jspxth_mytag_test_0 = new testTL();
    ^
    2 errors
    My taglibs looks like this:
    <?xml version="1.0"?>
    <!DOCTYPE taglib
         PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
         "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
    <taglib>
         <tlibversion>1.0</tlibversion>
         <jspversion>1.1</jspversion>
         <shortname>shorttest</shortname>
         <uri></uri>
         <info>abc</info>
         <tag>
              <name>test</name>
              <tagclass>testTL</tagclass>
         </tag>
    </taglib>
    And web.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
    <display-name>Tag Demo</display-name>
    <description>bla</description>
    <taglib>
    <taglib-uri>/shorttest</taglib-uri>
    <taglib-location>/WEB-INF/tld/test1.tld</taglib-location>
    </taglib>
    </web-app>
    the jsp:
    <%@ taglib uri="/shorttest" prefix="mytag" %>
    <html>
    <body>
    <mytag:test/>
    </body>
    </html>
    I can`t find the failure.
    Thanks
    Hayri

    Yes, change
    <tagclass>testTL</tagclass>
    to
    <tagclass>yourPackage.testTL</tagclass> and of course recompile class with package declaration and put into package.

  • How convert java FOR loop into  taglib directive

    hi all,
    I have following code in my Jsp. It is working but, we dont want to use java FOR loop anymore. Instead use corresponding taglib directive.
    How can i convert this Java FOR loop into taglib implementation of FOR loop ?
                   <%
                   for(int i=0;i< arrMemberBenefit.length;i++)     {
                        pageContext.setAttribute("arrMemberBenefiti", arrMemberBenefit);
    System.out.println("PCPNAME: " + arrMemberBenefit[0].getPcpName());
    %>
                        <tr class="rowOdd">
                             <td headers="t1h1" class="first"><c:out value="${arrMemberBenefiti.member.firstName}${space}${arrMemberBenefiti.member.lastName}" /></td>
                             <td headers="t1h2" class="last"><c:out value="${arrMemberBenefiti.pcpName}" /></td>
                        </tr>
    <%}
    %>
    pl any help highly apprecialted
    pp

    Using the JSTL forEach tag:
    I have used your variable name for arrMemberBenefiti
    myself I would probably call it something like memberBenefit
    You may need to put the array into an attribute to begin with
    // just in case
    <% pageContext.setAttribute("arrMemberBenefit", arrMemberBenefit); %>
    // and the actual JSTL loop
    <c:forEach var="arrMemberBenefiti" items="${arrMemberBenefit}">
      <tr class="rowOdd">
        <td headers="t1h1" class="first"><c:out value="${arrMemberBenefiti.member.firstName}${space}${arrMemberBenefiti.member. lastName}" /></td>
        <td headers="t1h2" class="last"><c:out value="${arrMemberBenefiti.pcpName}" /></td>
      </tr>
    </c:forEach>Cheers,
    evnafets

  • Bean has been used before the taglib directive.

    Hi all,
    While i am trying to execute my proj, i am getting the follwing error.
    Error(1): Prefix: bean has been used before the taglib directive. Use a different prefix or move the taglib directive above any references to this prefix.
    Error(2): Prefix: html has been used before the taglib directive. Use a different prefix or move the taglib directive above any references to this prefix.
    It is referring to the following piece of code. Can anyone explain me about the error here as i can't pick it up.
    <%@ page isErrorPage="true" import="java.io.PrintStream"%>
    <%@ page contentType="text/html;charset=windows-1252"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <LINK REL=Stylesheet TYPE="text/css" href="../css/GStyle.css">
    <title>My Error Page</title>
    </head>
    <body>
    <%@ include file="/common/Banner.jsp" %>
    <!--
    <h3>Hello-My Error Page</h3>
    -->
    <%@ include file="messages.jsp"%>
    </br>
    </br>
    <input type="Button" value="Back" onclick='history.go(-1);' class="button" />
    </body>
    </html>
    What should i modify here?
    Thanks in advance,,

    u mite have declared the taglib in both these includes...
    <%@ include file="/common/Banner.jsp" %>
    <!--
    <h3>Hello-My Error Page</h3>
    -->
    <%@ include file="messages.jsp"%>Regards
    Shanu

  • Taglib directive

              Hi,
              I have a taglib in my web application and have placed the taglib directive as
              the first line of the JSP.
              When I try to view the page I get a compilation error complaining that _releaseTags()
              is missing. If you look at the generated Java for the JSP it is indeed missing.
              If I move the taglib directive so that it comes after the <%page directives i.e.
              contentType, language, everything works fine. Looking at the generated Java for
              the JSP now the _releaseTags() method is present.
              Is there a known problem with the taglib being the first line of the JSP?
              This happens in WLS 6.0 and 6.1 beta
              Thanks in advance for you help,
              Gavin
              

    Hi Gavin,
              Do you still have the taglib _releaseTags() problem? We also ran into the same problem with WL 6.0 and looking for solutions. Is there any solution other than moving the taglib directive below page directive?
              Thanks in advance.
              Regards
              Shiva
              

  • JSP taglib tags

    hello every one
    i am using JSP taglibs in my work and i am trying the example given in book - " JSP The Complete Reference" . example of database operations . In chapter 11.
    But when i compile i am getting warning that EVAL_BODY_TAG is deprecated.
    so i would like to know what can i use instead of EVAL_BODY_TAG
    Thanks
    Amol

    Use either "EVAL_BODY_BUFFERED" or "EVAL_BODY_AGAIN".

  • EL or RT expressions for JSP taglibs

    I have a simple question
    We all know that there are two ways to implement a JSP page. either RT expressions or expression language (EL). I have done plenty of research and I am comfortable at creating custom JSP taglibs that support both RT and EL. What I want to know is which if them is used more commonly?
    Its useless to right 2 seperated libs, since you can pass variables from EL to RT and vice versa, so I want to have only one tag library, but I dont know how I should implement it EL or RT.
    What is used more often and why? What is the advantages of using one over the other. Thank you!!!

    RT was the original way; it required scriptlets, which everyone hates.
    EL is the new way; it helps eliminate scriptlets, which everyone loves.
    EL is the method of choice; even moreso when JSP 2.0 is finalized, it allows them to be used more freely (not just in tags)

  • Can I change the JSP page directive dynamically??

    Should I be able to use the JSP page directive...i.e.,
    ("<% reponse.setContentType("application/vnd.ms-excel"); %>
    ...to *dynamically* switch the page content depending on the users choice? -- Or, do I have to build separate JSP pages??
    I want to be able to switch the content-type based on the user choice from "content="text/html" to "content-type: application/vnd.ms-excel"... or vice versa.
    If so, does someone have an JSP example of doing this?
    Thanks for any quick response!!

    <%
    int userchoice = Session("userchoice") // this may also come from database or somewhere
    If (userchoice == 1)
    reponse.setContentType("application/vnd.ms-excel");
    else
    reponse.setContentType(content="text/html");
    %>

  • Difference between jsp:forward sendRedirect and jsp include directive

    Am very much confused, please explain me the difference between
    jsp:forward sendRedirect and jsp include directive with a suitable example.
    I'll be very gratefull. Its very urgent.

    One basic difference. The include executes in the .jsp servelet created. The redirect transfers "control" by redirecting the client request to another destination. In other words, the current .jsp is no longer in charge or in the calling chain in any way.

  • I18n jsp taglib, hot update

    Hi
    I'm investigating use of the jsp taglib i18n that comes with Personalization
    server.
    Is there any way of updating the .properties files so that the changes come
    thru reliably without restarting the server?
    A kind of reloadCheckSecs=0 like for jsp files would be good.
    Does such a functionality exist?
    Has anyone implemented such a functionality?
    Alternatively, is the code for the taglib available?
    Regards
    Alex

    If you need more information, don't know what I mean or whatever, please ask.
    I realy need this but don't know how to do...

  • Error in using taglib uri in jsp

    When i write the following code in my jsp to use the tags, i got the error -
    JSP Parsing Error:The absolute uri: http://java.sun.com/jsf/html cannot be resolved in either web.xml or the jar files deployed with this application     
    And when i used the tld (html_basic.tld & jsf_core.tld), it gave me the error
    JSP Parsing Error:Failed to load or instantiate TagLibraryValidator class: com.sun.faces.taglib.html_basic.HtmlBasicValidator

    you can use
    <taglib>
    <taglib-uri>/WEB-INF/html-basic.tld</taglib-uri>
    <taglib-location>
    /WEB-INF/html-basic.tld
    </taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>/WEB-INF/jsf-core.tld</taglib-uri>
    <taglib-location>
    /WEB-INF/jsf-core.tld
    </taglib-location>
    </taglib>
    in your web.xml

Maybe you are looking for

  • My iPad 2 does not find my Big Blue Live speaker! What do I do?

    My iPad 2 does not find my Big Blue Live speaker! What do I do?

  • How do I have dual monitor for different windows

    I wanted to use two monitors. One to monitor my file while the other as my working window. I am using Imac Intel Duo Core 17" and I heard that I need to buy the adapter. If I buy the adapter, what else need I click so that the FCE can be split into 2

  • Segmentation using ECC Infoset

    Hi, I want to  create a target group to differentiate employees based on Company code or sales organization I need to create a datasource using infoset from  ECC. i have used an infoset from ECC - /SAPQUERY/HR_ADM and also assigned the function modul

  • Patch 1909556 Errors

    I have 2 questions in connection with the Patch 1909556 which I applied to my Portal 3.0.9.8 instance: 1) I want to clean the transport tables completely. I ran the command exec.wwutl_tx_api.truncate_transport_tables. But when I try to run the applic

  • Import record-automatic

    Hi all, I am facing an interesting issue. I have imported one record using IMPORT SERVER as automatic by placing the xml file in the ready folder. That record have the partner number as "50001" with the name " rahul". It was imported successfully. Af