KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > oscache > web > tag > GroupsTag


1 /*
2  * Copyright (c) 2002-2003 by OpenSymphony
3  * All rights reserved.
4  */

5 package com.opensymphony.oscache.web.tag;
6
7 import javax.servlet.jsp.JspTagException JavaDoc;
8 import javax.servlet.jsp.tagext.TagSupport JavaDoc;
9
10 /**
11  * GroupsTag is a tag that add a comma-delimited list of groups to an ancestor CacheTag's groups.<p>
12  *
13  * @author <a HREF="mailto:ltorunski@t-online.de">Lars Torunski</a>
14  */

15 public class GroupsTag extends TagSupport JavaDoc {
16     private Object JavaDoc groups = null;
17
18     public int doStartTag() throws JspTagException JavaDoc {
19         CacheTag ancestorCacheTag = (CacheTag) TagSupport.findAncestorWithClass(this, CacheTag.class);
20
21         if (ancestorCacheTag == null) {
22             throw new JspTagException JavaDoc("GroupsTag cannot be used from outside a CacheTag");
23         }
24
25         ancestorCacheTag.addGroups(String.valueOf(groups));
26         
27         return EVAL_BODY_INCLUDE;
28     }
29
30     public void setGroups(Object JavaDoc groups) {
31         this.groups = groups;
32     }
33 }
34
Popular Tags