1 17 18 package com.finalist.jag.taglib; 19 20 21 22 import com.finalist.jag.*; 23 import com.finalist.jag.taglib.util.RequestUtil; 24 25 import java.util.*; 26 27 28 35 public class EmptyTag extends TagBodySupport { 36 37 38 private String name = null; 39 40 41 private String property = null; 42 43 44 protected boolean body = false; 45 46 47 protected int counter = 0; 48 49 51 58 public String getName() { 59 return (this.name); 60 } 61 62 69 public void setName(String name) { 70 this.name = name; 71 } 72 73 80 public String getProperty() { 81 return (this.property); 82 } 83 84 91 public void setProperty(String property) { 92 this.property = property; 93 } 94 95 104 public int doStartTag() throws JagException { 105 106 String value = RequestUtil.lookupString(getPageContext(), name, 107 property); 108 109 if ((value != null) && (value.length() < 1)) { 110 body = true; 111 } 112 113 if (value == null) { 114 Collection col = RequestUtil.lookupCollection(getPageContext(), 115 name, property); 116 117 body = (col != null) && (col.size() < 1); 118 } 119 120 return (EVAL_PAGE); 121 } 122 123 132 public int doAfterBodyTag() throws JagException { 133 134 return (body && (counter++ < 1)) 135 ? (EVAL_BODY_TAG) 136 : (SKIP_BODY); 137 } 138 } | Popular Tags |