关于 BeanListHandler的用法
来源:互联网 发布:苏州网络品牌营销 编辑:程序博客网 时间:2024/05/16 07:33
首先定义一个bean 要和数据库里的表的字段的类型对应ShowTestReportBean
在bean里建立set和get方法
然后在数据库里查 该表
方法为:
public List selectTestRecord(String proudct_brand)
{
final String SQL="select test_description,test_according,test_result from test_record where product_brand=?";
Object[] params = new Object[] { proudct_brand };
BeanListHandler blh = new BeanListHandler(ShowTestReportBean.class,
ModifiedRowProcesser.instance());
List testRecordtList = new ArrayList();
try {
testRecordtList = (ArrayList) db.query(SQL, params, blh);
} catch (SQLException e) {
e.printStackTrace();
}
return testRecordtList;
}
这样查出来的结果就直接以bean的形式 放到了list里
然后在jsp页面进行调用就可以了
jsp页面代码如 下:
调试该连接数据库方法是否好用 <body>
<%
String product_brand="1";
UserConn db = new UserConn();
List list = db.selectTestRecord(product_brand);
for(int i=0; i<list.size(); i++){
ShowTestReportBean t = (ShowTestReportBean) list.get(i);
out.print(t.getTestAccording()+"********");
out.println(t.getTestResult()+"------");
}
%>
</body>
嘿嘿终于会用这个 了 - -!
- 关于 BeanListHandler的用法
- BeanListHandler
- BeanListHandler
- dbutils中使用BeanListHandler时发生的错误
- BeanListHandler演示
- 今天在使用commons-dbutils时的,BeanListHandler处理赋值,有些值为空的错误
- 如何将DBUtil中使用BeanListHandler中转返回的List存入一个JSONArray中
- 关于memcpy的用法
- 关于__doPostBack()的用法
- 关于MagicAjax的用法
- 关于rownum 的用法
- 关于的用法mktemp
- 关于StringToKenizer的用法
- 关于数组的用法
- 关于M_PI的用法
- 关于typedef的用法
- 关于map的用法
- 关于dbnull的用法
- 随笔一下
- iSilo for S60 4.32 破解
- innerText,innerHTML的用法
- QuidWay S3026的端口聚合
- Ubuntu 服务器指南
- 关于 BeanListHandler的用法
- [PB]今日问题
- 使用indy 9发送邮件支持SSL选项,gmail测试通过
- 关于Eclipse无法重新编译java文件的处理方法之一
- sqlserver 数据导出到oracle
- 打造一个实用的Ubuntu
- AJAX项目中在IE浏览器上遇到"Internet Explorer无法打开站点,已终止操作"错误解决方案
- Oracle数据库达到连接上限
- ABAP--what is the difference between V1 ,V2&V3 update?