1 16 package org.apache.taglibs.standard.tag.el.sql; 17 18 import javax.servlet.jsp.JspException ; 19 20 import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; 21 import org.apache.taglibs.standard.tag.common.sql.QueryTagSupport; 22 23 29 public class QueryTag extends QueryTagSupport { 30 31 private String dataSourceEL; 32 private String sqlEL; 33 private String startRowEL; 34 private String maxRowsEL; 35 36 39 44 public QueryTag() { 45 super(); 46 } 47 48 51 public void setDataSource(String dataSourceEL) { 52 this.dataSourceEL = dataSourceEL; 53 this.dataSourceSpecified = true; 54 } 55 56 60 public void setStartRow(String startRowEL) { 61 this.startRowEL = startRowEL; 62 } 63 64 68 public void setMaxRows(String maxRowsEL) { 69 this.maxRowsEL = maxRowsEL; 70 this.maxRowsSpecified = true; 71 } 72 73 79 public void setSql(String sqlEL) { 80 this.sqlEL = sqlEL; 81 } 82 83 public int doStartTag() throws JspException { 84 evaluateExpressions(); 85 return super.doStartTag(); 86 } 87 88 91 private void evaluateExpressions() throws JspException { 93 Integer tempInt = null; 94 95 if (dataSourceEL != null) { 96 rawDataSource = (Object ) ExpressionEvaluatorManager.evaluate( 97 "dataSource", dataSourceEL, Object .class, this, pageContext); 98 } 99 100 if (sqlEL != null) { 101 sql = (String ) ExpressionEvaluatorManager.evaluate("sql", sqlEL, 102 String .class, this, pageContext); 103 } 104 105 if (startRowEL != null) { 106 tempInt = (Integer ) ExpressionEvaluatorManager.evaluate( 107 "startRow", startRowEL, Integer .class, this, pageContext); 108 if (tempInt != null) 109 startRow = tempInt.intValue(); 110 } 111 112 if (maxRowsEL != null) { 113 tempInt = (Integer ) ExpressionEvaluatorManager.evaluate( 114 "maxRows", maxRowsEL, Integer .class, this, pageContext); 115 if (tempInt != null) 116 maxRows = tempInt.intValue(); 117 } 118 } 119 } 120 | Popular Tags |