KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > taglibs > util > AAttribute


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.util;
14
15 import javax.servlet.jsp.JspException JavaDoc;
16 import javax.servlet.jsp.tagext.TagSupport JavaDoc;
17
18
19 /**
20  * Tag which can be nested in a AHref tag in order to add parameters.
21  * @author Marcel Salathe
22  * @author Fabrizio Giustina
23  * @version $Revision $ ($Author $)
24  */

25 public class AAttribute extends TagSupport JavaDoc {
26
27     /**
28      * Stable serialVersionUID.
29      */

30     private static final long serialVersionUID = 222L;
31
32     /**
33      * Value tag attribute.
34      */

35     private String JavaDoc value;
36
37     /**
38      * Name tag attribute.
39      */

40     private String JavaDoc name;
41
42     /**
43      * Setter for the <code>name</code> tag attribute.
44      * @param name name of the attribute
45      */

46     public void setName(String JavaDoc name) {
47         this.name = name;
48     }
49
50     /**
51      * Setter for the <code>value</code> tag attribute.
52      * @param value value of the attribute
53      */

54     public void setValue(String JavaDoc value) {
55         this.value = value;
56     }
57
58     /**
59      * @see javax.servlet.jsp.tagext.Tag#doEndTag()
60      */

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

75     public void release() {
76         this.name = null;
77         this.value = null;
78         super.release();
79     }
80
81 }
82
Popular Tags