1 28 29 package com.caucho.jstl; 30 31 import com.caucho.util.L10N; 32 33 import javax.servlet.jsp.JspException ; 34 import javax.servlet.jsp.tagext.TagSupport ; 35 36 public class RemoveTag extends TagSupport { 37 private static L10N L = new L10N(RemoveTag.class); 38 39 private String var; 40 private String scope; 41 42 45 public void setVar(String var) 46 { 47 this.var = var; 48 } 49 50 53 public void setScope(String scope) 54 { 55 this.scope = scope; 56 } 57 58 61 public int doStartTag() 62 throws JspException 63 { 64 if (scope == null) { 65 pageContext.removeAttribute(var); 66 } 67 else if (scope.equals("page")) { 68 pageContext.removeAttribute(var); 69 } 70 else if (scope.equals("request")) { 71 pageContext.getRequest().removeAttribute(var); 72 } 73 else if (scope.equals("session")) { 74 pageContext.getSession().removeAttribute(var); 75 } 76 else if (scope.equals("application")) { 77 pageContext.getServletContext().removeAttribute(var); 78 } 79 else 80 throw new JspException (L.l("illegal scope value {0}", scope)); 81 82 return SKIP_BODY; 83 } 84 } 85 | Popular Tags |