Jsp+JavaBean连接数据库问题! 去掉<%@ page import="sun.jdbc.odbc.JdbcOdbcDriver.*" %> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 hehe还是不行。不过为什要把这一行去掉呢? 最好不要返回记录集类型的数据;你可以在bean里将数据条数计算出来,然后通过返回整型数值的方法得到数据条数。 改代码如下,经测试可行<%java.lang.String strSQL;int intRowCount;strSQL = "select count(*) as A from table1 "; ResultSet rs = DBconn1.executeQuery(strSQL); while (rs.next()) {allCol = intRowCount.getInt("A"); }%> 错了,抱歉改代码如下,经测试可行<%java.lang.String strSQL;int intRowCount;strSQL = "select count(*) as A from table1 "; ResultSet rs = DBconn1.executeQuery(strSQL); while (rs.next()) {intRowCount= rs.getInt("A"); }%> <jsp:useBean id="DBconn1" class="DBconn" scope="request"/><jsp:setProperty name="DBconn" property="*"/>上面这两句话有误:第二句中name="DBconn" 是不是该为"DBconn1" Struts中用JavaScript 验证是否发帖可以得可用分 请教一下 myeclipse工程目录下有个 .myeclipse文件夹 他有什么用???????? 关于页面内容伸缩展开的问题 struts中文乱吗问题提问! 求助!Java网络编程? jsp文件无法运行,请教!!我急!!在线等啊 愤怒!!!!为什么我的信誉分无缘无故被扣掉了15分??!!斑竹请进来说明一下!! 在线等!请问,如何同时向两个或更多的不同的url发送请求? TOMCAT中的虚拟目录表示方法? 十分簡單的問題﹐只要你做過"JSP的數據庫訪問"就能回答﹐我是在送分啊... 请教高手sql语句插入日期的问题
你可以在bean里将数据条数计算出来,然后通过返回整型数值的方法得到数据条数。
<%
java.lang.String strSQL;
int intRowCount;
strSQL = "select count(*) as A from table1 ";
ResultSet rs = DBconn1.executeQuery(strSQL);
while (rs.next()) {
allCol = intRowCount.getInt("A");
}
%>
<%
java.lang.String strSQL;
int intRowCount;
strSQL = "select count(*) as A from table1 ";
ResultSet rs = DBconn1.executeQuery(strSQL);
while (rs.next()) {
intRowCount= rs.getInt("A");
}
%>
<jsp:setProperty name="DBconn" property="*"/>
上面这两句话有误:
第二句中name="DBconn" 是不是该为"DBconn1"