out.println(rs.getString(0));
改成:out.println(rs.getString(1));列的序号是从1开始的!!!类里面要加几个方法!public void closeConn()
{
if(connTr != null && !connTr.isClosed())
connTr.close();
connTr = null;
if(connQ != null && !connQ.isClosed())
connQ.close();
connQ = null;
break MISSING_BLOCK_LABEL_103;
SQLException ex;
ex;
System.err.println("DbAction.closeConn:" + ex.getMessage());
return;
} public void closeCstmt()
{
if(cstmt != null)
cstmt.close();
cstmt = null;
break MISSING_BLOCK_LABEL_58;
SQLException ex;
ex;
System.err.println("DbAction.closeCstmt:" + ex.getMessage());
return;
} public void closeRs()
{
if(rs != null)
rs.close();
rs = null;
break MISSING_BLOCK_LABEL_58;
SQLException ex;
ex;
System.err.println("DbAction.closeRs:" + ex.getMessage());
return;
}每次数据库操作完以后要关闭记录集、statement和数据库连接!目录配置没什么特殊的要求!\webapp\WEB-INF\classes
\lib
改成:out.println(rs.getString(1));列的序号是从1开始的!!!类里面要加几个方法!public void closeConn()
{
if(connTr != null && !connTr.isClosed())
connTr.close();
connTr = null;
if(connQ != null && !connQ.isClosed())
connQ.close();
connQ = null;
break MISSING_BLOCK_LABEL_103;
SQLException ex;
ex;
System.err.println("DbAction.closeConn:" + ex.getMessage());
return;
} public void closeCstmt()
{
if(cstmt != null)
cstmt.close();
cstmt = null;
break MISSING_BLOCK_LABEL_58;
SQLException ex;
ex;
System.err.println("DbAction.closeCstmt:" + ex.getMessage());
return;
} public void closeRs()
{
if(rs != null)
rs.close();
rs = null;
break MISSING_BLOCK_LABEL_58;
SQLException ex;
ex;
System.err.println("DbAction.closeRs:" + ex.getMessage());
return;
}每次数据库操作完以后要关闭记录集、statement和数据库连接!目录配置没什么特殊的要求!\webapp\WEB-INF\classes
\lib
^^
从"1"开始!!
^^^^
jsp:useBean
org.apache.jasper.JasperException: Unable to compile class for JSPAn error occurred at line: 1 in the jsp file: /displaydata.jspGenerated servlet error:
[javac] Compiling 1 source fileC:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\DocLib\displaydata_jsp.java:43: cannot resolve symbol
symbol : class opendb
location: class org.apache.jsp.displaydata_jsp
opendb jspid = null;
^An error occurred at line: 1 in the jsp file: /displaydata.jspGenerated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\DocLib\displaydata_jsp.java:45: cannot resolve symbol
symbol : class opendb
location: class org.apache.jsp.displaydata_jsp
jspid = (opendb) pageContext.getAttribute("jspid", PageContext.SESSION_SCOPE);
^An error occurred at line: 1 in the jsp file: /displaydata.jspGenerated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\DocLib\displaydata_jsp.java:48: cannot resolve symbol
symbol : class opendb
location: class org.apache.jsp.displaydata_jsp
jspid = (opendb) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "opendb");
^
3 errors
我想这还是和目录结构有关吧。我的文件是这样存放的:
C:\Program Files\Apache Group\Tomcat 4.1\Webapps\DocLib
class文件放在:
C:\Program Files\Apache Group\Tomcat 4.1\Webapps\DocLib\WEB-INF\classesJSP文件放在:
C:\Program Files\Apache Group\Tomcat 4.1\Webapps\DocLib这样行么?那么我引用这个BEAN时用到的语句:
<jsp:usebean id="jspid" class="opendb" scope="session"/>
是否正确?请指点。
先谢谢以上回帖的大哥们了!
<jsp:usebean id="jspid" class="opendb.opendb" scope="session"/>
就是
<jsp:useBean id="jspid" class=".opendb" scope="session"/>