1 17 18 package com.finalist.jag.taglib; 19 20 import com.finalist.jag.*; 21 import com.finalist.jag.taglib.util.RequestUtil; 22 23 24 31 public class ExistTag extends TagBodySupport { 32 33 34 private String name = null; 35 36 37 private String property = null; 38 39 40 protected boolean exist = false; 41 42 43 protected int counter = 0; 44 45 47 54 public String getName() { 55 return (this.name); 56 } 57 58 65 public void setName(String name) { 66 this.name = name; 67 } 68 69 76 public String getProperty() { 77 return (this.property); 78 } 79 80 87 public void setProperty(String property) { 88 this.property = property; 89 } 90 91 100 public int doStartTag() throws JagException { 101 exist = !(RequestUtil.lookupString(getPageContext(), name, property) == null && 102 getPageContext().getAttribute(name) == null); 104 return (EVAL_PAGE); 105 } 106 107 114 protected boolean exist() { 115 return (exist && (counter++ < 1)); 116 } 117 118 127 public int doAfterBodyTag() throws JagException { 128 129 return exist() 130 ? (EVAL_BODY_TAG) 131 : (SKIP_BODY); 132 } 133 } 134 135 | Popular Tags |