1 53 54 package com.Yasna.forum.tags; 55 56 import javax.servlet.jsp.tagext.*; 57 import com.Yasna.forum.*; 58 import javax.servlet.jsp.*; 59 60 65 public class IsApprovedTag extends TagSupport { 66 67 private boolean value = true; 68 private boolean attrSet = false; 69 70 public int doStartTag() throws JspException { 71 if (!attrSet) { 72 value = true; 73 } 74 attrSet = false; 75 try { 76 MessageTag mt = getMessageTag(); 77 if (mt.isApproved() == value) { 78 return EVAL_BODY_INCLUDE; 79 } 80 } catch(Exception e) { 81 } 82 return SKIP_BODY; 83 } 84 85 89 private MessageTag getMessageTag() { 90 MessageTag mt = null; 91 try { 92 mt = (MessageTag)this.findAncestorWithClass(this, 93 Class.forName("com.Yasna.forum.tags.MessageTag")); 94 } catch(Exception e) { 95 } 96 return mt; 97 } 98 99 103 public void setValue(String v) { 104 attrSet = true; 105 value = true; 106 if ("false".equals(v)) value = false; 107 } 108 109 } | Popular Tags |