自定义标志问题

easthg98 2003-09-12 03:51:45
如果我的标志处理器文件如下:
import java.io.IOException;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.util.*;
public class JsExampleTag extends BodyTagSupport
{
public JsExampleTag()
{
}
public int doEndTag() throws JspTagException
{
String ls_alert="";
try
{
BodyContent bc=getBodyContent();
if (bc!=null)
{
String ls_message=bc.getString();
JsExample js=new JsExample();
ls_alert=js.alert(ls_message.trim());
}
pageContext.getOut().write(ls_alert);
}
catch (IOException e)
{
throw new JspTagException("error"+e.toString());
}
return EVAL_PAGE;
}
}
他的JsExampleTag.class文件存在C:\tomcat-4.0\webapps\ROOT\WEB-INF\classes
如何写JsExampleTag.tld文件。
我写的JsExampleTag.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>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>Js</shortname>
<info>this is test tag library!</info>

<tag>
<name>message</name>
<tagclass>JsExampleTag</tagclass>
<info>alert</info>
</tag>
</taglib>
但是系统提示如下错误:
An error occurred at line: 5 in the jsp file: /tag.jsp

Generated servlet error:
C:\tomcat-4.0\work\Standalone\localhost\_\tag$jsp.java:59: Class org.apache.jsp.JsExampleTag not found.
JsExampleTag _jspx_th_JavaScript_message_0 = new JsExampleTag();
^


An error occurred at line: 5 in the jsp file: /tag.jsp

Generated servlet error:
C:\tomcat-4.0\work\Standalone\localhost\_\tag$jsp.java:59: Class org.apache.jsp.JsExampleTag not found.
JsExampleTag _jspx_th_JavaScript_message_0 = new JsExampleTag();
请问各位如何解决,一定给分
...全文
21 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
kaibinsj 2003-09-12
  • 打赏
  • 举报
回复
对tag不熟,帮你up!

81,091

社区成员

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

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