首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

初学者请问JSP+SQL留言板的有关问题,3个异常~搞不明白啊多谢啦

2013-09-11 
菜鸟请教JSP+SQL留言板的问题,3个错误~搞不明白啊~~谢谢啦org.apache.jasper.JasperException:Unabletocom

菜鸟请教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.myexception.cn/j2ee/2308.html

热点排行