Topic: taglib高手请帮个忙 (cannot resolve '/helloworld' into a valid tag library)

  Print this page

1.taglib高手请帮个忙 (cannot resolve '/helloworld' into a valid tag library) Copy to clipboard
Posted by: luowei
Posted on: 2004-10-11 22:41

{ 请尽量用准确的文字描述作为标题 }

我用jbuilder+weblogic开发taglib,一切都正常,但浏览时页面会报错
Parsing of JSP File '/my.jsp' failed:
--------------------------------------------------------------------------------
/my.jsp(2): Could not parse deployment descriptor: java.io.IOException: cannot resolve '/helloworld' into a valid tag library
probably occurred due to an error in /my.jsp line 2:
<%@ taglib uri="/helloworld" prefix="mytag" %>
--------------------------------------------------------------------------------
哪位高手告诉我哪个地方错了

2.Re:taglib高手请帮个忙 (cannot resolve '/helloworld' into a valid tag library) [Re: luowei] Copy to clipboard
Posted by: why
Posted on: 2004-10-11 22:53

Have you defined the taglib in web.xml and put its jar file in the proper (i.e. that you decalred) location?

3.Re:taglib高手请帮个忙 (cannot resolve '/helloworld' into a valid tag library) [Re: luowei] Copy to clipboard
Posted by: chengbd
Posted on: 2004-10-12 15:58

已经和你说过了,问题没有描述清楚,别人没法帮你。

4.Re:taglib高手请帮个忙 (cannot resolve '/helloworld' into a valid tag library) [Re: luowei] Copy to clipboard
Posted by: luowei
Posted on: 2004-10-12 16:24

我用jbuilder+weblogic开发taglib,一切都正常,但浏览时页面会报错
以下是我的代码。
jsp代码
<%@ page contentType="text/html;charset =GBK"%>
<%@ taglib uri="/helloworld" prefix="mytag" %>
<html>
<head>
<title>
this is my first tag
</title>
</head>
<body bgcolor="#ffffff">
<h1>
<mytag:hello></mytag:hello>
</h1>
</body>
</html>
web.xml代码
<?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>
<taglib>
<taglib-uri>/helloworld</taglib-uri>
<taglib-location>/WEB-INF/tlds/helloworld.tld</taglib-location>
</taglib>
</web-app>
helloworld.tld代码
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>mytag</short-name>
<description>Simple tag library.</description>
<tag>
<name>hello</name>
<tag-class>mytag.HelloWorldTag</tag-class>
<body-content>empty</body-content>
<description>Simple tag</description>
</tag>
</taglib>
HelloWorldTag.java代码
package mytag;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
/**
*
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright Coffee 2003</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class HelloWorldTag extends TagSupport
{
public int doEndTag() throws JspException {
try {
pageContext.getOut().write("Hello world.<br/>");
}
catch (java.io.IOException ex) {
throw new JspTagException("错误:不能输出到页面");
}
return EVAL_PAGE;
}
}
以下是报错信息
Parsing of JSP File '/my.jsp' failed:
--------------------------------------------------------------------------------
/my.jsp(2): Could not parse deployment descriptor: java.io.IOException: cannot resolve '/helloworld' into a valid tag library
probably occurred due to an error in /my.jsp line 2:
<%@ taglib uri="/helloworld" prefix="mytag" %>
--------------------------------------------------------------------------------

5.Re:taglib高手请帮个忙 (cannot resolve '/helloworld' into a valid tag library) [Re: luowei] Copy to clipboard
Posted by: hzxl
Posted on: 2004-11-07 21:51

你的tld文件呢?

6.Re:taglib高手请帮个忙 (cannot resolve '/helloworld' into a valid tag library) [Re: luowei] Copy to clipboard
Posted by: peaked
Posted on: 2004-11-09 17:30

my.jsp文件中<%@ taglib uri="/helloworld" prefix="mytag" %>
web.xml文件中<taglib-uri>/helloworld</taglib-uri>

有问题,你可以改成这样:
<%@ taglib uri="helloworld" prefix="mytag" %>

<taglib-uri>helloworld</taglib-uri>

就应该没有问题了

7.Re:taglib高手请帮个忙 (cannot resolve '/helloworld' into a valid tag library) [Re: luowei] Copy to clipboard
Posted by: peaked
Posted on: 2004-11-09 17:31

你应该仔细看看出错提示:

/my.jsp(2): Could not parse deployment descriptor: java.io.IOException: cannot resolve '/helloworld' into a valid tag library
probably occurred due to an error in /my.jsp line 2:
<%@ taglib uri="/helloworld" prefix="mytag" %>


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923