求助: Cannot find the declaration of element 'taglib'

wang_tai 2007-04-24 01:42:58
求助!!
=================================
环境:
在Weblogic8.1 + Eclipse3.0 + 局域网与internet完全隔离的,下建立自定义标签
=================================
内容:
mytag.tld内容
<?xml version="1.0" encoding="UTF-8" ?>
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd"
version="2.0">
<description>xmddl 1.1 hello library</description>
<display-name>xmddl hello</display-name>
<tlib-version>1.1</tlib-version>
<short-name>hello</short-name>
<uri>http://www.xmddl.com/tag</uri>
<tag>
<description>我的Hello World</description>
<name>hello_int</name>
<tag-class>HelloTag_Interface</tag-class>
<body-content>empty</body-content>
</tag>
</taglib>
web.xml内容:
<taglib>
<taglib-uri>mytag</taglib-uri>
<taglib-location>/WEB-INF/tlds/mytag.tld</taglib-location>
</taglib>
hello.jsp内容
<%@ taglib uri="mytag" prefix="hello" %>
<hello:hello_int/>
=================================
错误:
启动服务器提示错误如下:
"/WEB-INF/tlds/mytag.tld" でタグ ライブラリ記述子を解析中にエラーが発生しました。
("/WEB-INF/tlds/mytag.tld" 发生数据记录解析错误)
运行JSP文件提示错误如下:
"/WEB-INF/tlds/mytag.tld"不正确。DTD cvc-elt.1: Cannot find the declaration of element 'taglib'. (5行、17列)
weblogic.servlet.jsp.JspException: (line -1): cannot load TLD: weblogic.xml.dom.ChildCountException: missing child tagclass in tag
at weblogic.servlet.jsp.TagLibHelper.loadTagLib(TagLibHelper.java:328)
at weblogic.servlet.jsp.JspLexer.loadTagLib(JspLexer.java:145)
......
请大家帮忙,谢谢,我已经找了两天了,还不知道应该怎么解决问题。
...全文
1685 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
wang_tai 2007-04-24
  • 打赏
  • 举报
回复
已经完事了,谢谢大家

最后用的是southben() 方法解决的问题

马上给分
ulovei 2007-04-24
  • 打赏
  • 举报
回复
mytag.tld文件不用改。
你把你的web.xml文件贴出来看看.
wang_tai 2007-04-24
  • 打赏
  • 举报
回复
重启后这个错误还省一个错误:
<2007/04/24 15時04分40秒 CST> <Warning> <HTTP> <BEA-101248> <[ServletContext(id=2829560,name=Sample,context-path=/Sample)]: "/WEB-INF/tlds/mytag.tld" 错误。DTD cvc-elt.1: Cannot find the declaration of element 'taglib'. (行 5、列 17) 。>
southben 2007-04-24
  • 打赏
  • 举报
回复
给你一个正确的,8.1可能对2的支持不行,你使用这个
<?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>
.....
wang_tai 2007-04-24
  • 打赏
  • 举报
回复
我已经删掉嘞
提示错误如下:
<2007/04/24 15时29分06秒 CST> <Warning> <HTTP> <BEA-101248> <[Sample.war]: 配置文件"web.xml" 不正确 DTD org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'web-app'. (行 1列 10) >
ulovei 2007-04-24
  • 打赏
  • 举报
回复
把web.xml文件中关于<taglib>的定义删除掉
wang_tai 2007-04-24
  • 打赏
  • 举报
回复
楼上的大哥,那样的情况我也试验过了,没有成功,错误提示如下
<2007/04/24 15時04分40秒 CST> <Warning> <HTTP> <BEA-101248> <[ServletContext(id=2829560,name=Sample,context-path=/Sample)]: デプロイメント記述子 "/WEB-INF/tlds/mytag.tld" は正しくありません。DTD cvc-elt.1: Cannot find the declaration of element 'taglib'. (行 5、カラム 17) を確認してください。>

大概含义:
<2007/04/24 15時04分40秒 CST> <Warning> <HTTP> <BEA-101248> <[ServletContext(id=2829560,name=Sample,context-path=/Sample)]: 配置记录 "/WEB-INF/tlds/mytag.tld" 是不正确的。DTD cvc-elt.1: Cannot find the declaration of element 'taglib'. (行 5、列 17) 请确认。>

请大家继续帮忙
ulovei 2007-04-24
  • 打赏
  • 举报
回复
<%@ taglib uri="mytag" prefix="hello" %>
<hello:hello_int/>
==========================
<%@ taglib uri="http://www.xmddl.com/tag" prefix="hello" %>
<hello:hello_int/>
此处直接引用mytag.tld中定义的<taglib>中的uri

不行的,好像只有xml3.0以上的不用写web.xml里
==========================
和xml文件没关系,JSP1.2和JSP2.0的容器均会自动到WEB-INF及META-INF目录下去找.tld文件
wang_tai 2007-04-24
  • 打赏
  • 举报
回复
不行的,好像只有xml3.0以上的不用写web.xml里
上面的办法不行
ulovei 2007-04-24
  • 打赏
  • 举报
回复
不需要在web.xml文件中配置<taglib>,只管在jsp中引用即可。
wang_tai 2007-04-24
  • 打赏
  • 举报
回复
有阿!
这个问题,我觉得非常奇怪,
高手们,帮帮忙吧
谢谢诸位了!
lxsshizishizi 2007-04-24
  • 打赏
  • 举报
回复
请检查一下路径“WEB-INF/tlds/”下面有没有mytag.tld文件。

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧