1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package org.dbforms.taglib;
25
26 import javax.servlet.http.HttpServletRequest;
27 import javax.servlet.jsp.JspException;
28 import org.dbforms.util.Util;
29
30
31
32 /***
33 * #fixme docu to come
34 *
35 * @author Joe Peer
36 *
37 */
38 public class DbBlobURLTag extends AbstractDbBaseHandlerTag
39 implements javax.servlet.jsp.tagext.TryCatchFinally {
40 /*** DOCUMENT ME! */
41 protected String nameField;
42
43 /***
44 * DOCUMENT ME!
45 *
46 * @param nameField DOCUMENT ME!
47 */
48 public void setNameField(String nameField) {
49 this.nameField = nameField;
50 }
51
52
53 /***
54 * DOCUMENT ME!
55 *
56 * @return DOCUMENT ME!
57 */
58 public String getNameField() {
59 return nameField;
60 }
61
62
63
64
65
66
67 /***
68 * Description of the Method
69 *
70 * @return Description of the Return Value
71 *
72 * @exception javax.servlet.jsp.JspException Description of the Exception
73 */
74 public int doEndTag() throws javax.servlet.jsp.JspException {
75 try {
76 StringBuffer tagBuf = new StringBuffer(((HttpServletRequest) pageContext
77 .getRequest()).getContextPath());
78
79 tagBuf.append("/servlet/file?tf=")
80 .append(getTableFieldCode())
81 .append("&keyval=")
82 .append(getKeyVal());
83
84
85 if (this.nameField != null) {
86 tagBuf.append("&nf=");
87 tagBuf.append(nameField);
88 }
89
90
91 if (getDefaultValue() != null) {
92 tagBuf.append("&defaultValue=" + getDefaultValue());
93
94
95 }
96
97
98
99 String dbConnectionName = getParentForm().getDbConnectionName();
100 if (!Util.isNull(dbConnectionName)) {
101 tagBuf.append("&invname_"+getParentForm().getTable().getId());
102 tagBuf.append("=").append(dbConnectionName);
103 }
104 pageContext.getOut()
105 .write(tagBuf.toString());
106 } catch (java.io.IOException ioe) {
107 throw new JspException("IO Error: " + ioe.getMessage());
108 }
109
110 return EVAL_PAGE;
111 }
112
113
114 /***
115 * DOCUMENT ME!
116 */
117 public void doFinally() {
118 super.doFinally();
119 }
120
121
122 /***
123 * Gets the keyVal attribute of the DbBlobURLTag object
124 *
125 * @return The keyVal value
126 */
127 protected String getKeyVal() {
128 return getParentForm()
129 .getTable()
130 .getKeyPositionString(getParentForm().getResultSetVector());
131 }
132
133
134
135
136
137 /***
138 * Generates the decoded name.
139 *
140 * @return The tableFieldCode value
141 */
142 private String getTableFieldCode() {
143 StringBuffer buf = new StringBuffer();
144
145 buf.append(getParentForm().getTable().getId());
146 buf.append("_");
147 buf.append(getField().getId());
148
149 return buf.toString();
150 }
151 }