Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 23 24 package org.dbforms.taglib; 25 26 import javax.servlet.jsp.JspException ; 27 import javax.servlet.jsp.PageContext ; 28 29 import javax.sql.DataSource ; 30 31 32 33 39 public class DbSetDataSource extends DbBaseHandlerTag 40 implements javax.servlet.jsp.tagext.TryCatchFinally { 41 private String dataSource; 42 private String dbConnectionName; 43 44 49 public void setDataSource(String string) { 50 dataSource = string; 51 } 52 53 54 59 public String getDataSource() { 60 return dataSource; 61 } 62 63 64 69 public void setDbConnectionName(String name) { 70 dbConnectionName = name; 71 } 72 73 74 79 public String getDbConnectionName() { 80 return dbConnectionName; 81 } 82 83 84 87 public void doCatch(Throwable t) throws Throwable { 88 throw t; 89 } 90 91 92 95 public void doFinally() { 96 dbConnectionName = null; 97 super.doFinally(); 98 } 99 100 101 109 public int doStartTag() throws JspException { 110 try { 111 DataSource ds = getConfig() 113 .getDataSource(dbConnectionName); 114 pageContext.setAttribute(getDataSource(), ds, PageContext.PAGE_SCOPE); 115 } catch (Exception e) { 116 throw new JspException ("Database error" + e.getMessage()); 117 } 118 119 return SKIP_BODY; 120 } 121 } 122
| Popular Tags
|