日期:2014-05-18  浏览次数:20680 次

TLD问题
TstimeTag.java
package   testdb;

import   javax.servlet.jsp.tagext.*;
import   javax.servlet.jsp.*;
import   java.text.SimpleDateFormat;

public   class   TstimeTag   extends   TagSupport   {

public   int   doEndTag()throws   JspException{
SimpleDateFormat   sdf;
sdf=new   SimpleDateFormat( "HH:mm:ss ");
String   time=sdf.format(new   java.util.Date());
try{
pageContext.getOut().print(time);
}
catch(Exception   e){
throw   new   JspException(e.toString());
}
return   EVAL_PAGE;
}
}

TEST/WEBROOT/WEB-INF/exampleTags.tld
<?xml   version= "1.0 "   encoding= "ISO-8859-1 "   ?>
<!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>
      <tlib-version> 1.0 </tlib-version>
      <jsp-version> 1.1 </jsp-version>
      <short-name> ExampleTags </short-name>
      <description> a   test   of   tag </description>
      <tag>
          <name> time </name>
          <tag-class> testdb.TstimeTag </tag-class>
      </tag>
</taglib>

example中出现了错误
问题描述:
Referenced   file   contains   errors   (http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd).     For   more   information,   right   click   on   the   message   and   select   "Show   Details... "

------解决方案--------------------
我觉得应该要实现
public int doStartTag() throws JspException {
return EVAL_BODY_INCLUDE;
}
请把你的JSP引用贴出来看看.
试试http://java.sun.com/dtd/web-jsptaglibrary_1_1.dtd