菜鸟请教JSP+SQL留言板的问题,3个错误~搞不明白啊~~谢谢啦

yashirodash 2007-04-29 03:22:14
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 15 in the jsp file: /jspmo/index.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\news\org\apache\jsp\jspmo\index_jsp.java:93: cannot resolve symbol
symbol : variable tab
location: class org.apache.jsp.jspmo.index_jsp
String sql="select * from "+tab+" order by id desc";
^


An error occurred at line: 15 in the jsp file: /jspmo/index.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\news\org\apache\jsp\jspmo\index_jsp.java:94: cannot resolve symbol
symbol : variable st
location: class org.apache.jsp.jspmo.index_jsp
java.sql.ResultSet rs = st.executeQuery(sql);
^


An error occurred at line: 413 in the jsp file: /jspmo/index.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\news\org\apache\jsp\jspmo\index_jsp.java:585: cannot resolve symbol
symbol : variable st
location: class org.apache.jsp.jspmo.index_jsp
st.close();
^
3 errors

index.jsp(部分)
<%
int i=0,x=0;//计数器
int showrow=4;//每页显示条数
int pages=0;//当前页数
int start; //本页开始条数
String sql="select * from "+tab+" order by id desc";
java.sql.ResultSet rs = st.executeQuery(sql);
String strp=(String)request.getParameter("pages");
String pass=null;pass=(String)session.getAttribute("pass");

救命啊,如果要index原件联系我QQ16038579谢谢达人了,还有很多关于JSP方面问题请教~
...全文
216 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
yashirodash 2007-04-29
  • 打赏
  • 举报
回复
谢谢大家拉,果然是tab没有声明初始化~
什么都不能 2007-04-29
  • 打赏
  • 举报
回复
tab是否声明并初始化,st 是否定义?executeQuery的SQLException捕获了吗?
thinker28754 2007-04-29
  • 打赏
  • 举报
回复
对于要读写数据库的语句要放在try...catch(Excetpion e){}里.

81,090

社区成员

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

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