DefinitionTag.java 文件源码

java
阅读 35 收藏 0 点赞 0 评论 0

项目:lams 作者:
/**
 * Process nested ≶putList> tag.
 * Method is called from nested ≶putList> tags.
 * Nested list is added to current list.
 * If role is defined, nested attribute is wrapped into an untyped definition
 * containing attribute value and role.
 */
public void processNestedTag(PutListTag nestedTag) throws JspException {
    // Get real value and check role
    // If role is set, add it in attribute definition if any.
    // If no attribute definition, create untyped one and set role.
    Object attributeValue = nestedTag.getList();

    if (nestedTag.getRole() != null) {
        AttributeDefinition def = new UntypedAttribute(attributeValue);
        def.setRole(nestedTag.getRole());
        attributeValue = def;
    }

    // Check if a name is defined
    if (nestedTag.getName() == null) {
        throw new JspException("Error - PutList : attribute name is not defined. It is mandatory as the list is added to a 'definition'.");
    }

    // now add attribute to enclosing parent (i.e. : this object).
    putAttribute(nestedTag.getName(), attributeValue);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号