1 16 17 package org.apache.taglibs.dbtags.connection; 18 19 import java.sql.Connection ; 20 import java.sql.SQLException ; 21 22 import javax.servlet.jsp.tagext.TagSupport ; 23 24 45 public class CloseConnectionTag extends TagSupport { 46 47 private String _connId = null; 48 49 58 public void setConn(String connectionId) { 59 _connId = connectionId; 60 } 61 62 public int doStartTag() { 63 64 try { 65 Connection conn = (Connection )pageContext.getAttribute(_connId); 66 conn.close(); 67 conn = null; 68 } catch (SQLException e) { 69 e.printStackTrace(); 71 } 72 73 return EVAL_BODY_INCLUDE; 74 } 75 76 public void release() { 77 _connId = null; 78 } 79 80 } 81 | Popular Tags |