1 16 17 package org.apache.taglibs.standard.tag.el.core; 18 19 import javax.servlet.jsp.JspException ; 20 import javax.servlet.jsp.PageContext ; 21 import javax.servlet.jsp.tagext.Tag ; 22 23 import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; 24 import org.apache.taglibs.standard.tag.common.core.NullAttributeException; 25 26 32 33 public class ExpressionUtil { 34 35 40 public static Object evalNotNull(String tagName, 41 String attributeName, 42 String expression, 43 Class expectedType, 44 Tag tag, 45 PageContext pageContext) 46 throws JspException { 47 if (expression != null) { 48 Object r = ExpressionEvaluatorManager.evaluate( 49 attributeName, expression, expectedType, tag, pageContext); 50 if (r == null) 51 throw new NullAttributeException(tagName, attributeName); 52 return r; 53 } else 54 return null; 55 } 56 } 57 | Popular Tags |