KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > cofax > taglibs > PutTag


1 /*
2  * PutTag is part of the Cofax content management system library.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Please see http://www.cofax.org for contact information and other related informaion.
19  *
20  * $Header: /cvsroot/cofax/cofax/src/org/cofax/taglibs/PutTag.java,v 1.3.2.1 2006/12/11 16:27:38 fxrobin Exp $
21  */

22
23 package org.cofax.taglibs;
24
25 import javax.servlet.*;
26 import javax.servlet.jsp.*;
27 import javax.servlet.jsp.tagext.*;
28 import org.cofax.*;
29
30 /**
31  * PutTag is a tag to set variables in the main glossary.
32  *
33  * @param name
34  * example: name="request:publication"
35  * @param value
36  * example: value="inquirer"
37  */

38 public class PutTag extends TagSupport {
39
40     // init & set flag for each params
41
private String JavaDoc name = "";
42
43     private String JavaDoc value = "";
44
45     /**
46      * Set's the Name for the hash glossary.
47      */

48     public void setName(String JavaDoc name) {
49
50         if (name != null && !name.equals("")) {
51             this.name = name;
52         }
53     }
54
55     /**
56      * Get's the Name.
57      */

58     public String JavaDoc getName() {
59         return (name);
60     }
61
62     /**
63      * Set's the Value for the hash glossary.
64      */

65     public void setValue(String JavaDoc value) {
66         if (value != null && !value.equals("")) {
67             this.value = value;
68         }
69     }
70
71     /**
72      * Get's the Value.
73      */

74     public String JavaDoc getValue() {
75         return (value);
76     }
77
78     /**
79      * Set's the Name/Value to the main glossary.
80      */

81     public int doEndTag() throws JspException {
82         ServletRequest req = pageContext.getRequest();
83         CofaxPage cofaxPage = (CofaxPage) req.getAttribute("cofaxPage");
84         cofaxPage.putGlossaryValue(this.name, this.value);
85         return (SKIP_BODY);
86     }
87
88 } // end PutTag
89

90
Popular Tags