1 12 package org.displaytag.tags; 13 14 import javax.servlet.jsp.PageContext ; 15 import javax.servlet.jsp.tagext.BodyTagSupport ; 16 17 import org.displaytag.exception.ObjectLookupException; 18 import org.displaytag.util.LookupUtil; 19 20 21 27 public abstract class TemplateTag extends BodyTagSupport 28 { 29 30 51 protected Object evaluateExpression(String expression) throws ObjectLookupException 52 { 53 54 String expressionWithoutScope = expression; 55 56 int scope = PageContext.REQUEST_SCOPE; 59 60 if (expression.startsWith("pageScope.")) { 62 scope = PageContext.PAGE_SCOPE; 63 expressionWithoutScope = expressionWithoutScope.substring(expressionWithoutScope.indexOf('.') + 1); 64 } 65 else if (expression.startsWith("requestScope.")) { 67 scope = PageContext.REQUEST_SCOPE; 68 expressionWithoutScope = expressionWithoutScope.substring(expressionWithoutScope.indexOf('.') + 1); 69 70 } 71 else if (expression.startsWith("sessionScope.")) { 73 scope = PageContext.SESSION_SCOPE; 74 expressionWithoutScope = expressionWithoutScope.substring(expressionWithoutScope.indexOf('.') + 1); 75 76 } 77 else if (expression.startsWith("applicationScope.")) { 79 scope = PageContext.APPLICATION_SCOPE; 80 expressionWithoutScope = expressionWithoutScope.substring(expressionWithoutScope.indexOf('.') + 1); 81 82 } 83 84 return LookupUtil.getBeanValue(this.pageContext, expressionWithoutScope, scope); 85 86 } 87 88 } | Popular Tags |