1 31 32 package org.opencms.jsp; 33 34 import javax.servlet.jsp.tagext.TagData ; 35 import javax.servlet.jsp.tagext.TagExtraInfo ; 36 37 47 public class CmsJspTagIncludeTEI extends TagExtraInfo { 48 49 private static final String ATTR_ATTRIBUTE = "attribute"; 50 private static final String ATTR_FILE = "file"; 51 private static final String ATTR_PAGE = "page"; 52 private static final String ATTR_PROPERTY = "property"; 53 private static final String ATTR_SUFFIX = "suffix"; 54 55 62 public static boolean isSpecified(TagData data, String attributeName) { 63 64 return (data.getAttribute(attributeName) != null); 65 } 66 67 80 public boolean isValid(TagData data) { 81 82 boolean hasFile = isSpecified(data, ATTR_FILE) || isSpecified(data, ATTR_PAGE); 83 boolean hasSuffix = isSpecified(data, ATTR_SUFFIX); 84 boolean hasProperty = isSpecified(data, ATTR_PROPERTY); 85 boolean hasAttribute = isSpecified(data, ATTR_ATTRIBUTE); 86 88 if (hasFile && (hasSuffix || hasProperty || hasAttribute)) { 89 return false; 90 } 91 if (hasProperty && hasAttribute) { 92 return false; 93 } 94 if (hasSuffix && !(hasProperty || hasAttribute)) { 95 return false; 96 } 97 98 return true; 99 } 100 } 101 | Popular Tags |