Refine search
/** * The value of the tag's id attribute. * * @return the value of the tag's id attribute, or null if no such * attribute was specified. */ public String getId() { return getAttributeString(TagAttributeInfo.ID); }
/** * Translation-time validation of the attributes. * Request-time attributes are indicated as such in the TagData parameter. * Because of the higher quality validation messages possible, * this is the preferred way to do validation (although isValid() * still works). * * <p>JSP 2.0 and higher containers call validate() instead of isValid(). * The default implementation of this method is to call isValid(). If * isValid() returns false, a generic ValidationMessage[] is returned * indicating isValid() returned false.</p> * * @param data The TagData instance. * @return A null object, or zero length array if no errors, an * array of ValidationMessages otherwise. * @since JSP 2.0 */ public ValidationMessage[] validate( TagData data ) { ValidationMessage[] result = null; if( !isValid( data ) ) { result = new ValidationMessage[] { new ValidationMessage( data.getId(), "isValid() == false" ) }; } return result; }
public VariableInfo[] getVariableInfo(TagData data) { // construct the relevant VariableInfo object VariableInfo id = new VariableInfo( data.getAttributeString("id"), data.getAttributeString("type") == null ? "java.lang.Object" : data.getAttributeString("type"), true, VariableInfo.AT_END); return new VariableInfo[] { id }; } }
public VariableInfo[] getVariableInfo(TagData data) { String type = data.getAttributeString("type"); Object name = data.getAttribute("name"); if (type == null) { if (name==null) { type = "java.lang.String"; } else { type = "java.lang.Object"; } } return new VariableInfo[] { new VariableInfo(data.getAttributeString("id"), type, true, VariableInfo.AT_END ) }; }
public VariableInfo[] getVariableInfo(TagData data) { String varName = data.getId(); if (varName == null) return new VariableInfo[0]; else return (new VariableInfo[]{ new VariableInfo(varName, "java.lang.String", true, VariableInfo.AT_END) }); } }
/** * Checks to ensure that where the tag supports providing one of two attributes * that one and only one is provided. */ @Override public ValidationMessage[] validate(final TagData tag) { Collection<ValidationMessage> errors = new ArrayList<ValidationMessage>(); Object beanclass = tag.getAttribute("beanclass"); Object binding = tag.getAttribute("binding"); if (!(beanclass != null ^ binding != null)) { errors.add(new ValidationMessage(tag.getId(), "Exactly one of 'beanclass' or 'binding' must be supplied.")); } String var = tag.getAttributeString("var"); String id = tag.getAttributeString("id"); if (!(var != null ^ id != null)) { errors.add(new ValidationMessage(tag.getId(), "Exactly one of 'var' or 'id' must be supplied.")); } return errors.toArray(new ValidationMessage[errors.size()]); } }
static String safeGetStringAttribute(TagData data, String attributeName) { final Object attribute = data.getAttribute(attributeName); if (attribute == TagData.REQUEST_TIME_VALUE) { return null; } return data.getAttributeString(attributeName); }
/** * Returns true if the given attribute name is specified, false otherwise. */ public static boolean isSpecified(TagData data, String attributeName) { return (data.getAttribute(attributeName) != null); }
@Override public ValidationMessage[] validate(TagData data) { final List<ValidationMessage> messages = new ArrayList<ValidationMessage>(); Object o = data.getAttribute("fname"); if (o == null) { messages.add(new ValidationMessage(data.getId(), "fname cannot be null.")); } if (messages.size() == 0) { return null; } return messages.toArray(new ValidationMessage[messages.size()]); } }
for (int i = 0; i <= 2; i+) { t1 = new TagData(); t1.setName("Motor" + i); list.add(t1); }
@Override public VariableInfo[] getVariableInfo(TagData data) { // construct the relevant VariableInfo object VariableInfo id = new VariableInfo( data.getAttributeString("id"), data.getAttributeString("type") == null ? "java.lang.Object" : data.getAttributeString("type"), true, VariableInfo.AT_END); return new VariableInfo[]{id}; } }
/** * Return information about the scripting variables to be created. */ public VariableInfo[] getVariableInfo(TagData data) { String className = null; if (data.getAttribute("multiple") == null) className = "javax.servlet.http.Cookie"; else className = "javax.servlet.http.Cookie[]"; return new VariableInfo[] { new VariableInfo(data.getAttributeString("id"), className, true, VariableInfo.AT_BEGIN) }; }
public VariableInfo [] getVariableInfo (TagData data) { String varName = data.getId(); if ( varName == null ) { return new VariableInfo[] {}; } else { return new VariableInfo [] { new VariableInfo(varName, "java.lang.String", true, VariableInfo.AT_END) }; } }
/** * Checks to ensure that where the tag supports providing one of two * attributes that one and only one is provided. * @param tag * @return */ @Override public ValidationMessage[] validate(final TagData tag) { Collection<ValidationMessage> errors = new ArrayList<ValidationMessage>(); Object beanclass = tag.getAttribute("beanclass"); Object binding = tag.getAttribute("binding"); if (!(beanclass != null ^ binding != null)) { errors.add(new ValidationMessage(tag.getId(), "Exactly one of 'beanclass' or 'binding' must be supplied.")); } String var = tag.getAttributeString("var"); String id = tag.getAttributeString("id"); if (!(var != null ^ id != null)) { errors.add(new ValidationMessage(tag.getId(), "Exactly one of 'var' or 'id' must be supplied.")); } return errors.toArray(new ValidationMessage[errors.size()]); } }
/** * Returns true if the given attribute name is specified, false otherwise. */ public static boolean isSpecified(TagData data, String attributeName) { return (data.getAttribute(attributeName) != null); }
/** * Clone the tag data. */ protected Object clone() throws CloneNotSupportedException { return new TagData((Hashtable<String, Object>) attributes.clone()); }
public VariableInfo[] getVariableInfo(TagData data) { // construct the relevant VariableInfo object VariableInfo id = new VariableInfo( data.getAttributeString("id"), data.getAttributeString("type") == null ? "java.lang.Object" : data.getAttributeString("type"), true, VariableInfo.AT_END); return new VariableInfo[] { id }; } }
/** * Return information about the scripting variables to be created. */ public VariableInfo[] getVariableInfo(TagData data) { String className = null; if (data.getAttribute("multiple") == null) className = "java.lang.String"; else className = "java.lang.String[]"; return new VariableInfo[] { new VariableInfo(data.getAttributeString("id"), className, true, VariableInfo.AT_BEGIN) }; }