以下给简单地给出了使用的范例,请参考:
<%@ page contenttype="text/html" import="operate_db.*,java.sql.*" %>
<jsp:usebean id="querybean" scope="request" class="operate_db.querybean" />
<%
string prm1,prm2,prm3;
resultset rst=null;
prm1 = ...;
prm2 = ...;
prm3 = ...;
querybean.setconnection("sun.jdbc.odbc.jdbcodbcdriver","jdbc:odbc:数据源名","sa","");
try{
string[] param = {prm1,prm2,prm3};
/*设置select语句*/
querybean.setquerystatement("select * from table where field1 = ? and field2=? and field3=?");
querybean.setparam(param);
rst=querybean.getresult();
}catch(exception e){system.out.println(e); }
while (rst.next()){
%><%=rst.getstring(1)%>
<%}%>
希望大家尊重作者的劳动,使用时保留作者信息以及版本信息等等,谢谢!
我的信箱:lci21@263.net
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器