菜鸟请教JSP+SQL留言板的问题,3个错误~搞不明白啊~~谢谢啦
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方面问题请教~
------解决方案--------------------对于要读写数据库的语句要放在try...catch(Excetpion e){}里.
------解决方案--------------------tab是否声明并初始化,st 是否定义?executeQuery的
SQLException捕获了吗?
我的异常网推荐解决方案:org.apache.jasper.JasperException: Unable to compile class,http://www.aiyiweb.com/j2ee/2308.