1 10 11 package org.mmbase.bridge.jsp.taglib.util; 12 13 import java.util.*; 14 15 import javax.servlet.jsp.JspTagException ; 16 17 import org.mmbase.bridge.jsp.taglib.ContextReferrerTag; 18 import org.mmbase.util.logging.*; 19 20 27 public abstract class Notfound { 28 private static final Logger log = Logging.getLoggerInstance(Notfound.class); 29 30 public final static int DEFAULT = -1; 31 public final static int THROW = 0; 32 public final static int SKIP = 1; 33 public final static int PROVIDENULL = 2; 34 public final static int MESSAGE = 3; 35 36 37 public static int get(Attribute notfound, ContextReferrerTag tag) throws JspTagException { 38 if (notfound == Attribute.NULL) { 39 return DEFAULT; 40 } 41 String is = notfound.getString(tag).toLowerCase(); 42 if ("skip".equals(is)) { 43 return SKIP; 44 } else if ("skipbody".equals(is)) { 45 return SKIP; 46 } else if ("throw".equals(is)) { 47 return THROW; 48 } else if ("exception".equals(is)) { 49 return THROW; 50 } else if ("throwexception".equals(is)) { 51 return THROW; 52 } else if ("null".equals(is)) { 53 return PROVIDENULL; 54 } else if ("providenull".equals(is)) { 55 return PROVIDENULL; 56 } else if ("message".equals(is)) { 57 return MESSAGE; 58 } else { 59 throw new JspTagException ("Invalid value for attribute 'notfound' " + is + "(" + notfound + ")"); 60 } 61 } 62 63 64 } 65 | Popular Tags |