KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > laures > cewolf > taglib > tags > ChartImgURLTag


1 /* ================================================================
2  * Cewolf : Chart enabling Web Objects Framework
3  * ================================================================
4  *
5  * Project Info: http://cewolf.sourceforge.net
6  * Project Lead: Guido Laures (guido@laures.de);
7  *
8  * (C) Copyright 2002, by Guido Laures
9  *
10  * This library is free software; you can redistribute it and/or modify it under the terms
11  * of the GNU Lesser General Public License as published by the Free Software Foundation;
12  * either version 2.1 of
13  * the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
16  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17  * See the GNU Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License along with this
20  * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */

23
24 package de.laures.cewolf.taglib.tags;
25
26 import java.io.IOException JavaDoc;
27
28 import javax.servlet.jsp.JspException JavaDoc;
29
30 /**
31  * This tag only renders the image URL instead of a full <img> tag.
32  * @author glaures
33  * @see de.laures.cewolf.taglib.tags.ChartImgTag
34  */

35 public class ChartImgURLTag extends ChartImgTag {
36     
37     public static final String JavaDoc VAR_NAME = "var";
38     
39     String JavaDoc var = null;
40     
41     public int doEndTag() throws JspException JavaDoc {
42         try {
43             if(var == null){
44                 pageContext.getOut().write(getImgURL());
45             } else {
46                 pageContext.setAttribute(var, getImgURL());
47             }
48         } catch(IOException JavaDoc ioex){
49             log.error(ioex);
50             throw new JspException JavaDoc(ioex.getMessage());
51         }
52         return doAfterEndTag(EVAL_PAGE);
53     }
54     
55     /**
56      * @see de.laures.cewolf.taglib.tags.CewolfBodyTag#reset()
57      */

58     protected void reset() {
59         super.reset();
60         var = null;
61     }
62
63     /**
64      * Returns the var.
65      * @return String
66      */

67     public String JavaDoc getVar() {
68         return var;
69     }
70
71     /**
72      * Sets the var.
73      * @param var The var to set
74      */

75     public void setVar(String JavaDoc var) {
76         this.var = var;
77     }
78
79 }
80
Popular Tags