groupstag.java

来自「oscache-2.4.1-full」· Java 代码 · 共 34 行

JAVA
34
字号
/*
 * Copyright (c) 2002-2003 by OpenSymphony
 * All rights reserved.
 */
package com.opensymphony.oscache.web.tag;

import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.tagext.TagSupport;

/**
 * GroupsTag is a tag that add a comma-delimited list of groups to an ancestor CacheTag's groups.<p>
 *
 * @author <a href="mailto:ltorunski@t-online.de">Lars Torunski</a>
 */
public class GroupsTag extends TagSupport {
    private Object groups = null;

    public int doStartTag() throws JspTagException {
        CacheTag ancestorCacheTag = (CacheTag) TagSupport.findAncestorWithClass(this, CacheTag.class);

        if (ancestorCacheTag == null) {
            throw new JspTagException("GroupsTag cannot be used from outside a CacheTag");
        }

        ancestorCacheTag.addGroups(String.valueOf(groups));
        
        return EVAL_BODY_INCLUDE;
    }

    public void setGroups(Object groups) {
        this.groups = groups;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?