Source code: com/obinary/cms/taglibs/Set.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 package com.obinary.cms.taglibs;
19
20
21 import com.obinary.cms.util.Resource;
22 import com.obinary.cms.core.Container;
23
24 import javax.servlet.jsp.tagext.TagSupport;
25 import javax.servlet.http.HttpServletRequest;
26 import javax.jcr.RepositoryException;
27
28
29 /**
30 * User: sameercharles
31 * Date: Apr 28, 2003
32 * Time: 11:20:59 AM
33 * @author Sameer Charles
34 * @version 1.0
35 */
36
37
38 public class Set extends TagSupport {
39
40
41
42 private Container container;
43 private String containerName;
44
45
46 /**
47 * <p>starts Edit tag</p>
48 *
49 * @return int
50 */
51 public int doStartTag() {
52 HttpServletRequest req = (HttpServletRequest)pageContext.getRequest();
53 Resource.removeGlobalContainer(req);
54 if (this.containerName == null)
55 Resource.setGlobalContainer(req,this.container);
56 else {
57 try {
58 this.container = Resource.getCurrentActivePage(req).getContainer(this.containerName);
59 Resource.setGlobalContainer(req,this.container);
60 } catch (RepositoryException re) {re.printStackTrace();}
61 }
62 return SKIP_BODY;
63 }
64
65
66
67 /**
68 * <p>continue evaluating jsp</p>
69 *
70 * @return int
71 */
72 public int doEndTag() {
73 return EVAL_PAGE;
74 }
75
76
77
78 /**
79 *
80 * @param container to be set
81 */
82 public void setContainer(Container container) {
83 this.container = container;
84 }
85
86
87
88 /**
89 *
90 * @param name , container name to be set
91 */
92 public void setContainerName(String name) {
93 this.containerName = name;
94 }
95
96
97
98 }