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;
13 import javax.servlet.jsp.tagext.Tag;
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 {
22 private String name;
23
24 public void setName(String name) {
25 this.name = name;
26 }
27
28 public int doAfterBody() {
29 Tag 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 }