1 18 19 package org.apache.strutsel.taglib.utils; 20 21 import javax.servlet.jsp.PageContext ; 22 import javax.servlet.jsp.JspException ; 23 import javax.servlet.jsp.tagext.Tag ; 24 import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; 25 26 33 public final class EvalHelper 34 { 35 private EvalHelper() {} 36 37 42 public static Object eval(String attrName, 43 String attrValue, 44 Tag tagObject, 45 PageContext pageContext) 46 throws JspException 47 { 48 Object result = null; 49 if (attrValue != null) { 50 result = 51 ExpressionEvaluatorManager. 52 evaluate(attrName, attrValue, Object .class, tagObject, 53 pageContext); 54 } 55 56 return (result); 57 } 58 59 64 public static String evalString(String attrName, 65 String attrValue, 66 Tag tagObject, 67 PageContext pageContext) 68 throws JspException 69 { 70 Object result = null; 71 if (attrValue != null) { 72 result = 73 ExpressionEvaluatorManager. 74 evaluate(attrName, attrValue, String .class, tagObject, 75 pageContext); 76 } 77 78 return ((String ) result); 79 } 80 81 86 public static Integer evalInteger(String attrName, 87 String attrValue, 88 Tag tagObject, 89 PageContext pageContext) 90 throws JspException 91 { 92 Object result = null; 93 if (attrValue != null) { 94 result = ExpressionEvaluatorManager. 95 evaluate(attrName, attrValue, Integer .class, tagObject, 96 pageContext); 97 } 98 99 return ((Integer ) result); 100 } 101 102 107 public static Boolean evalBoolean(String attrName, 108 String attrValue, 109 Tag tagObject, 110 PageContext pageContext) 111 throws JspException 112 { 113 Object result = null; 114 if (attrValue != null) { 115 result = ExpressionEvaluatorManager. 116 evaluate(attrName, attrValue, Boolean .class, tagObject, 117 pageContext); 118 } 119 120 return ((Boolean ) result); 121 } 122 } 123 | Popular Tags |