1 /*
2 * Title: UsePageTag
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.decorator;
11
12 import com.opensymphony.module.sitemesh.taglib.AbstractTag;
13
14 import javax.servlet.jsp.JspException;
15 import javax.servlet.jsp.PageContext;
16
17 /**
18 * Expose the Page as a bean to the page which can then be accessed
19 * from scriptlets.
20 *
21 * <p>Depending on the TEI used, the object will be
22 * {@link com.opensymphony.module.sitemesh.Page} or
23 * {@link com.opensymphony.module.sitemesh.HTMLPage}.</p>
24 *
25 * @author <a href="joe@truemesh.com">Joe Walnes</a>
26 * @version $Revision: 1.1 $
27 *
28 * @see UsePageTEI
29 * @see UseHTMLPageTEI
30 */
31 public class UsePageTag extends AbstractTag {
32 private String id = null;
33
34 /** Set name of variable the Page will be set as. */
35 public void setId(String id) {
36 this.id = id;
37 }
38
39 public final int doEndTag() throws JspException {
40 pageContext.setAttribute(id, getPage(), PageContext.PAGE_SCOPE);
41 return EVAL_PAGE;
42 }
43 }