快速业务通道

struts徭協吶炎禰?糞?廓曝和性僉夲崇 - 園殻秘壇利

作者 佚名技术 来源 NET编程 浏览 发布时间 2012-06-18

struts徭協吶炎禰?糞?廓曝和性僉夲崇

扮寂:2011-03-20

1 package com.pmjava.web.taglib; 2 import com.pmjava.jdbc.util.ConnectionFactory; 3 import com.pmjava.jdbc.util.DBclose; 4 import java.io.PrintStream; 5 import java.sql.*; 6 import javax.servlet.jsp.*; 7 import javax.servlet.jsp.tagext.TagSupport; 8 public class DbSelectByDbWhere extends TagSupport 9 { 10  private static final long serialVersionUID = 1L; 11  private String table_name; 12  private String id_col_name; 13  private String select_id; 14  private String name; 15  private String name_col_name; 16  private String condition; 17  private String pleaseselect; 18  private String sql_where; 19  private String id; 20  PreparedStatement ps; 21  ResultSet rs; 22  Connection con; 23  public DbSelectByDbWhere() 24  { 25   ps = null; 26   rs = null; 27   con = null; 28   try 29   { 30    jbInit(); 31   } 32   catch (Exception ex) 33   { 34    ex.printStackTrace(); 35   } 36  } 37  public int doStartTag() 38   throws JspException 39  { 40   if (sql_where == null || "null".equals(sql_where)) 41    sql_where = ""; 42   if (condition == null || "null".equals(condition)) 43    condition = ""; 44   try 45   { 46    con = ConnectionFactory.getConnection(); 47    pageContext.getOut().write(""); 48    if ("1".equals(pleaseselect)) 49     pageContext.getOut().write("僉夲廓曝"); 50    String Selected = null; 51    String Sql = "select * from " + table_name + " where 1=1 "; 52    if (!"".equals(sql_where) || sql_where != null) 53     Sql = Sql + "  and  city_id=" + sql_where + " "; 54    ps = con.prepareStatement(Sql); 55    for (rs = ps.executeQuery(); rs.next(); pageContext.getOut().write("" + rs.getString(name_col_name) + "")) 56     if (rs.getString(name_col_name).equals(select_id)) 57      Selected = "selected"; 58     else 59      Selected = ""; 60    pageContext.getOut().write(""); 61   } 62   catch (Exception e) 63   { 64    e.printStackTrace(); 65   } 66   finally 67   { 68    DBclose.close(rs, ps, con); 69   } 70   return 0; 71  } 72  public void setTable_name(String table_name) 73  { 74   this.table_name = table_name; 75  } 76  public void setId_col_name(String id_col_name) 77  { 78   this.id_col_name = id_col_name; 79  } 80  public void setSelect_id(String select_id) 81  { 82   this.select_id = select_id; 83  } 84  public void setName(String name) 85  { 86   this.name = name; 87  } 88  public void setName_col_name(String name_col_name)

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号