1 16 17 package org.apache.taglibs.standard.tag.common.core; 18 19 import javax.servlet.jsp.JspException ; 20 import javax.servlet.jsp.PageContext ; 21 import javax.servlet.jsp.tagext.TagSupport ; 22 23 29 public class RemoveTag extends TagSupport { 30 31 34 35 36 private final String APPLICATION = "application"; 37 private final String SESSION = "session"; 38 private final String REQUEST = "request"; 39 private final String PAGE = "page"; 40 41 44 private int scope; private boolean scopeSpecified; private String var; 48 49 52 57 public RemoveTag() { 58 super(); 59 init(); 60 } 61 62 private void init() { 64 var = null; 65 scope = PageContext.PAGE_SCOPE; 66 scopeSpecified = false; 67 } 68 69 public void release() { 71 super.release(); 72 init(); 73 } 74 75 76 79 public int doEndTag() throws JspException { 81 if (!scopeSpecified) 82 pageContext.removeAttribute(var); 83 else 84 pageContext.removeAttribute(var, scope); 85 return EVAL_PAGE; 86 } 87 88 89 92 public void setVar(String var) { 94 this.var = var; 95 } 96 97 public void setScope(String scope) { 99 this.scope = Util.getScope(scope); 100 scopeSpecified = true; 101 } 102 } 103 | Popular Tags |