1 18 package org.apache.beehive.netui.tags.html; 19 20 import org.apache.beehive.netui.tags.AbstractClassicTag; 21 import org.apache.beehive.netui.tags.ByRef; 22 import org.apache.beehive.netui.tags.ExpressionHandling; 23 import org.apache.beehive.netui.tags.rendering.AbstractHtmlControlState; 24 25 import javax.servlet.http.HttpServletRequest ; 26 import javax.servlet.jsp.JspException ; 27 import java.util.List ; 28 29 32 abstract public class HtmlDataSourceTag 33 extends HtmlFocusBaseTag 34 { 35 protected String _dataSource; 36 37 public HtmlDataSourceTag() 38 { 39 super(); 40 } 41 42 78 public void setDataSource(String dataSource) 79 { 80 _dataSource = dataSource; 81 } 82 83 89 protected List getNamingChain() 90 { 91 return AbstractClassicTag.DefaultNamingChain; 92 } 93 94 99 protected Object evaluateDataSource() 100 throws JspException  101 { 102 ExpressionHandling expr = new ExpressionHandling(this); 104 String datasource = "{" + _dataSource + "}"; 105 String ds = expr.ensureValidExpression(datasource, "dataSource", "DataSourceError"); 106 if (ds == null) 107 return null; 108 109 return expr.evaluateExpression(datasource, "dataSource", pageContext); 111 } 112 113 130 protected void nameHtmlControl(AbstractHtmlControlState state, ByRef javaScript) 131 throws JspException  132 { 133 assert (javaScript != null) : "paramater 'javaScript' may not be null"; 134 assert (state != null) : "parameter 'state' may not be null"; 135 assert (_dataSource != null) : "dataSource is Null"; 136 137 String datasource = "{" + _dataSource + "}"; 139 state.name = applyNamingChain(datasource); 140 141 Form parentForm = getNearestForm(); 142 String idScript = renderNameAndId((HttpServletRequest ) pageContext.getRequest(), state, parentForm); 143 if (idScript != null) 144 javaScript.setRef(idScript); 145 } 146 147 150 protected void localRelease() 151 { 152 super.localRelease(); 153 _dataSource = null; 154 } 155 } 156 | Popular Tags |