要在web.xml中添加
<taglib>
<taglib-uri>/your url </taglib-uri>
<taglib-location> location of tld file </taglib-location>
</taglib>

解决方案 »

  1.   

    <%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>在 tld 文件中,添加相关信息
      

  2.   

    1、创建class(假设你已经完成)
    2、创建tld文件,把你写的tld文件放在如下目录:
    /WEB-INF/tld/box.tld
    3、修改web.xml
    增加
      <taglib>
        <taglib-uri>box</taglib-uri>
        <taglib-location>/WEB-INF/tld/box.tld</taglib-location>
      </taglib>
    注意位置要正确。可以参考相应的dtd文件。
    4、在你要使用的jsp页面的顶部增加
    <%@ taglib uri="box" prefix="box" %>
      

  3.   

    必须做的:
    java 类文件,tld文件,web.xml文件,jsp里的标签调用。看看漏了什么
      

  4.   

    jsp头我是这样写的:<%@taglib prefix="tags" uri="WEB-INF/tags/box.tag" %>调用的时候是:<tags:box title="Login" bgcolor="#ccf" border="3" margin="70" padding="20">box.tag中的内容是:<%@ attribute name="bgcolor" %>
    <%@ attribute name="border" %>
    <%@ attribute name="padding" %>
    <%@ attribute name="margin" %>
    <%@ attribute name="title" %>
    <div style="
       background-color: ${bgcolor!=null?bgcolor:"transparent"};
       border: solid black ${border!=null?border:"0"}px;
       margin: ${margin!=null?margin:"5"}px;
       
    ">
    <div style="
       background-color: #000;
       color: ${bgcolor!=null?bgcolor:"transparent"};
       margin: 0;
       padding: ${title!=null?4:0}px;
       font-family: sans-serif;
       font-weight: bold;
       text-align: left;
    ">
    ${title}
    </div>
    <div style="padding: ${padding!=null?padding:"5"}px;">
    <jsp:doBody/>
    </div>
    </div>IE上报的错误是:XML parsing error on file /WEB-INF/tags/box.tag: (line 1, col 2): The up in the document preceding the root element must be well-formed.什么原因,哪位达人给分析一下??
      

  5.   

    1.编写标签的处理类(Tag Handler Class)
      ----YourTag.java(你已经完成,编译后放在在WEB-INF/classes下)
    2.创建标签库的描述文件(Tag Library Description File)
      ------box.tld,放在在WEB-INF/tags下,box.tld采用xml的文件格式,来定义用户的标签库,不应 该是你那样写的,譬如要定义:
        <taglib>
            ……
           <uri>/your uri</uri>
           <tag>
             <name>your tag</name>
             <tagclass>YourTag</tagclass>
             <bodycontent>empty</bodycontent>
             <attribute>
              ……
             </attribute>
           </tag>
       </taglib>
    3.修改web.xml文件,加入一下代码:
       <taglib>
       <taglib-uri>/your uri</taglib-uri>
       <taglib-location>/WEB-INF/tags/box.tld</taglib-location>
       </taglib>
    4.在jsp文件中引入标签,
    <%@ taglib uri="/your uri" prefix="tags"%>