KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > module > sitemesh > taglib > page > ParamTag


1 /*
2  * Title: ParamTag
3  * Description:
4  *
5  * This software is published under the terms of the OpenSymphony Software
6  * License version 1.1, of which a copy has been included with this
7  * distribution in the LICENSE.txt file.
8  */

9
10 package com.opensymphony.module.sitemesh.taglib.page;
11
12 import javax.servlet.jsp.tagext.BodyTagSupport JavaDoc;
13 import javax.servlet.jsp.tagext.Tag JavaDoc;
14
15 /**
16  * Add a parameter to the inline Decorator, as if specified in the Page.
17  *
18  * @author <a HREF="mailto:joe@truemesh.com">Joe Walnes</a>
19  * @version $Revision: 1.1 $
20  */

21 public class ParamTag extends BodyTagSupport JavaDoc {
22     private String JavaDoc name;
23
24     public void setName(String JavaDoc name) {
25         this.name = name;
26     }
27
28     public int doAfterBody() {
29         Tag JavaDoc parent = getParent();
30         if (parent instanceof ApplyDecoratorTag) {
31             ApplyDecoratorTag t = (ApplyDecoratorTag)parent;
32             t.addParam(name, getBodyContent().getString());
33         }
34         return SKIP_BODY;
35     }
36 }
Popular Tags