Source code: com/obinary/cms/taglibs/Attribute.java
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-2003 obinary Ltd. (http://www.obinary.com) All rights reserved.
11 *
12 * */
13
14
15
16
17
18
19
20 package com.obinary.cms.taglibs;
21
22 import javax.servlet.jsp.tagext.TagSupport;
23 import javax.servlet.jsp.JspException;
24
25
26 /**
27 * Date: Apr 28, 2003
28 * Time: 11:20:59 AM
29 * @author Marcel Salathe
30 * @version 1.0
31 */
32
33
34 public class Attribute extends TagSupport{
35
36 private String value = "";
37 private String name = "";
38
39
40
41 /**
42 * <p>end of tag</p>
43 *
44 * @return int
45 */
46 public int doEndTag() throws JspException {
47 Include parent = (Include)findAncestorWithClass(this, Include.class);
48 if (parent == null) {
49 throw new JspException("nesting error");
50 }
51 else {
52 parent.setAttribute(this.name, this.value);
53 }
54 return EVAL_PAGE;
55
56 }
57
58
59
60 /**
61 * @param name , name of the attribute
62 */
63 public void setName(String name) {
64 this.name = name;
65 }
66
67
68
69 /**
70 * @param value , value of the attribute
71 */
72 public void setValue(String value) {
73 this.value = value;
74 }
75
76 }