KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > bridge > jsp > taglib > security > SetContextTag


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.bridge.jsp.taglib.security;
11 import org.mmbase.bridge.jsp.taglib.NodeReferrerTag;
12 import org.mmbase.bridge.jsp.taglib.util.Attribute;
13 import javax.servlet.jsp.JspTagException JavaDoc;
14
15 import org.mmbase.util.logging.Logger;
16 import org.mmbase.util.logging.Logging;
17
18 /**
19  * A very simple tag to change the context of the node
20  *
21  * @author Michiel Meeuwissen
22  * @version $Id: SetContextTag.java,v 1.9 2005/03/14 19:02:35 michiel Exp $
23  */

24
25 public class SetContextTag extends NodeReferrerTag {
26
27     private static final Logger log = Logging.getLoggerInstance(SetContextTag.class);
28     private Attribute name = Attribute.NULL;
29
30     public void setName(String JavaDoc n) throws JspTagException JavaDoc {
31         name = getAttribute(n);
32     }
33
34     public int doEndTag() throws JspTagException JavaDoc {
35         String JavaDoc n;
36         if (name == Attribute.NULL) {
37             n = bodyContent.getString();
38         } else {
39             n = name.getString(this);
40         }
41         if (log.isDebugEnabled()) log.debug("Setting context to " + n);
42         getNode().setContext(n);
43         return super.doEndTag();
44     }
45
46 }
47
Popular Tags