KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > taglibs > Attribute


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2006 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.cms.taglibs;
14
15 import javax.servlet.jsp.JspException JavaDoc;
16 import javax.servlet.jsp.tagext.TagSupport JavaDoc;
17
18
19 /**
20  * @author Marcel Salathe
21  * @version $Revision: 6341 $ ($Author: philipp $)
22  */

23 public class Attribute extends TagSupport JavaDoc {
24
25     /**
26      * Stable serialVersionUID.
27      */

28     private static final long serialVersionUID = 222L;
29
30     /**
31      * Value of the attribute
32      */

33     private Object JavaDoc value;
34
35     /**
36      * Name of the attribute.
37      */

38     private String JavaDoc name;
39
40     /**
41      * @param name name of the attribute
42      */

43     public void setName(String JavaDoc name) {
44         this.name = name;
45     }
46
47     /**
48      * @param value value of the attribute
49      */

50     public void setValue(Object JavaDoc value) {
51         this.value = value;
52     }
53
54     /**
55      * @see javax.servlet.jsp.tagext.Tag#doEndTag()
56      */

57     public int doEndTag() throws JspException JavaDoc {
58         Include parent = (Include) findAncestorWithClass(this, Include.class);
59         if (parent == null) {
60             throw new JspException JavaDoc("nesting error"); //$NON-NLS-1$
61
}
62         parent.setAttribute(this.name, this.value);
63         return EVAL_PAGE;
64     }
65
66     /**
67      * @see javax.servlet.jsp.tagext.TagSupport#release()
68      */

69     public void release() {
70         this.name = null;
71         this.value = null;
72         super.release();
73     }
74 }
75
Popular Tags