KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dbforms > taglib > DbBlobURLTag


1 /*
2  * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/taglib/DbBlobURLTag.java,v 1.11 2004/08/18 12:26:05 hkollmann Exp $
3  * $Revision: 1.11 $
4  * $Date: 2004/08/18 12:26:05 $
5  *
6  * DbForms - a Rapid Application Development Framework
7  * Copyright (C) 2001 Joachim Peer <joepeer@excite.com>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  */

23
24 package org.dbforms.taglib;
25
26 import javax.servlet.http.*;
27 import javax.servlet.jsp.*;
28
29
30
31 /**
32  * #fixme docu to come
33  *
34  * @author Joe Peer
35  *
36  */

37 public class DbBlobURLTag extends DbBaseHandlerTag
38    implements javax.servlet.jsp.tagext.TryCatchFinally JavaDoc {
39    /** DOCUMENT ME! */
40    protected String JavaDoc nameField;
41
42    /**
43     * DOCUMENT ME!
44     *
45     * @param nameField DOCUMENT ME!
46     */

47    public void setNameField(String JavaDoc nameField) {
48       this.nameField = nameField;
49    }
50
51
52    /**
53     * DOCUMENT ME!
54     *
55     * @return DOCUMENT ME!
56     */

57    public String JavaDoc getNameField() {
58       return nameField;
59    }
60
61
62    /**
63     * @see javax.servlet.jsp.tagext.TryCatchFinally#doCatch(java.lang.Throwable)
64     */

65    public void doCatch(Throwable JavaDoc t) throws Throwable JavaDoc {
66       throw t;
67    }
68
69
70    // --------------------------------------------------------- Public Methods
71
// DbForms specific
72

73    /**
74     * Description of the Method
75     *
76     * @return Description of the Return Value
77     *
78     * @exception javax.servlet.jsp.JspException Description of the Exception
79     */

80    public int doEndTag() throws javax.servlet.jsp.JspException JavaDoc {
81       try {
82          StringBuffer JavaDoc tagBuf = new StringBuffer JavaDoc(((HttpServletRequest) pageContext
83                                                  .getRequest()).getContextPath());
84
85          tagBuf.append("/servlet/file?tf=")
86                .append(getTableFieldCode())
87                .append("&keyval=")
88                .append(getKeyVal());
89
90          // JPEer 03/2004
91
if (this.nameField != null) {
92             tagBuf.append("&nf=");
93             tagBuf.append(nameField);
94          }
95
96          // append the defaultValue parameter;
97
if (getDefaultValue() != null) {
98             tagBuf.append("&defaultValue=" + getDefaultValue());
99
100             //logCat.info("::doEndTag - defaultValue set to [" + defaultValue + "]");
101
}
102
103          pageContext.getOut()
104                     .write(tagBuf.toString());
105       } catch (java.io.IOException JavaDoc ioe) {
106          throw new JspException("IO Error: " + ioe.getMessage());
107       }
108
109       return EVAL_PAGE;
110    }
111
112
113    /**
114     * DOCUMENT ME!
115     */

116    public void doFinally() {
117       super.doFinally();
118    }
119
120
121    /**
122     * Gets the keyVal attribute of the DbBlobURLTag object
123     *
124     * @return The keyVal value
125     */

126    protected String JavaDoc getKeyVal() {
127       return getParentForm()
128                 .getTable()
129                 .getKeyPositionString(getParentForm().getResultSetVector());
130    }
131
132
133    // ------------------------------------------------------ Protected Methods
134
// DbForms specific
135

136    /**
137     * Generates the decoded name.
138     *
139     * @return The tableFieldCode value
140     */

141    private String JavaDoc getTableFieldCode() {
142       StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
143
144       buf.append(getParentForm().getTable().getId());
145       buf.append("_");
146       buf.append(getField().getId());
147
148       return buf.toString();
149    }
150 }
151
Popular Tags