关于自定义标签问题求助(up有分!)

ashui11 2004-02-23 10:21:01
请大家帮我分析一下错误在哪里
ATMjsp.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>ATMjsp</shortname>
<tag>
<name>ATM</name>
<tagclass>ATMTag</tagclass>
<bodycontent>JSP</bodycontent>
</tag>
</taglib>

ATM.jsp
<%@ page import="ATMTag" %>
<%@ taglib uri="ATMjsp.tld" prefix="ATMjsp" %>
<%@ page errorPage="errorpage.jsp" %>
<!DocType HTML Public "-//w3c//dtd HTML 4.0 Translational//EN ">
<html>
<head></head>
<body bgcolor="#fffffr">
<h3 align=center>ATM counters that need Cash</h3>
<table>
<tr>
<td></td>
<td><ATMjsp:ATM></td>
</tr>
</table>
</body>
</html>

ATMTag.java
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.io.*;
import java.sql.*;
import java.math.*;
import java.util.*;

public class ATMTag extends TagSupport{
Connection connect=null;
Statement state=null;
ResultSet result=null;
public ATMTag()throws ClassNotFoundException{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
public int doStartTag()throws JspTagException{
return EVAL_BODY_INCLUDE;
}

public int doEndTag()throws JspTagException{
try{
JspWriter out=pageContext.getOut();
connect=DriverManager.getConnection("jdbc:odbc:MyDataSource","sa","");
String strQuery="Select cCounter_id,cAddress,mCashBalance from Counter where mCashBalance<=10000";
state=connect.createStatement();
result=state.executeQuery(strQuery);
String sId=null;
String sAddress=null;
String sBalance=null;
Vector v=new Vector();

while(result.next()){
sId=result.getString(1);
sAddress=result.getString(2);
sBalance=result.getString(3);
v.add(sId);
v.add(sAddress);
v.add(sBalance);
}

for(int i=0;i<v.size();i++){
String str=(String)v.elementAt(i);
pageContext.getOut().write(str);
}
}catch(Exception e){}
return EVAL_PAGE;
}
}

错误提示:
org.apache.jasper.compiler.ParseException: End of content reached while more parsing required: tag nesting error?
...全文
25 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复

81,095

社区成员

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

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