1 53 54 106 107 package com.Yasna.forum.tags; 108 109 import java.io.*; 110 import java.util.*; 111 import javax.servlet.*; 112 import javax.servlet.jsp.*; 113 import javax.servlet.jsp.tagext.*; 114 import javax.servlet.http.*; 115 import com.Yasna.forum.tags.*; 116 117 137 public class ErrorTag extends TagSupport 138 { 139 private Boolean value = null; 140 141 144 public final int doStartTag() throws JspException 145 { 146 boolean result = false; 147 YazdRequest jr = (YazdRequest)pageContext.getAttribute("yazdUserRequest", 149 PageContext.REQUEST_SCOPE); 150 if( jr == null ) 151 throw new JspException("Yazd error tag could not find YazdRequest"); 152 153 List err = jr.getErrorList(); 155 if( err.size() > 0 ) 157 result = true; 158 159 if( value == null ) { 160 if( result ) 161 return EVAL_BODY_INCLUDE; 162 } else { 163 if( value.booleanValue() == result ) 164 return EVAL_BODY_INCLUDE; 165 } 166 167 return SKIP_BODY; 169 } 170 171 176 public void setValue(String str) 177 { 178 value = new Boolean (str); 179 } 180 } 181 | Popular Tags |