1 23 24 package org.dbforms.taglib; 25 26 import org.apache.commons.logging.Log; 27 import org.apache.commons.logging.LogFactory; 28 29 import org.dbforms.event.WebEvent; 30 31 import org.dbforms.util.Util; 32 33 import javax.servlet.jsp.JspException ; 34 35 36 37 43 public class IsWebEvent extends DbBaseHandlerTag 44 implements javax.servlet.jsp.tagext.TryCatchFinally { 45 private static Log logCat = LogFactory.getLog(IsWebEvent.class.getName()); 47 private String event; 48 private String value; 49 50 53 public IsWebEvent() { 54 value = "true"; 55 event = null; 56 } 57 58 63 public final void setEvent(String str) { 64 event = str; 65 } 66 67 68 73 public void setValue(String string) { 74 value = string; 75 } 76 77 78 83 public String getValue() { 84 return value; 85 } 86 87 88 91 public void doCatch(Throwable t) throws Throwable { 92 throw t; 93 } 94 95 96 99 public void doFinally() { 100 value = "true"; 101 event = null; 102 super.doFinally(); 103 } 104 105 106 113 public int doStartTag() throws JspException { 114 WebEvent we = getParentForm() 115 .getWebEvent(); 116 117 if ((we == null) || (event == null) || (value == null)) { 118 logCat.debug("Can't do IsWebEvent with webEvent: " + we + " event: " 119 + event + " value: " + value); 120 121 return SKIP_BODY; 122 } 123 124 String className = we.getType(); 125 126 boolean eventNameMatch = className.toUpperCase() 127 .indexOf(event.toUpperCase()) != -1; 128 129 if (logCat.isDebugEnabled()) { 130 logCat.debug(" IsLocalWebEvent webEvent className: " + className 131 + " event: " + event + " value: " + value); 132 } 133 134 return (Util.getTrue(value) == eventNameMatch) ? EVAL_BODY_INCLUDE 135 : SKIP_BODY; 136 } 137 } 138 | Popular Tags |