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 org.dbforms.config.*;
27
28 import javax.servlet.jsp.*;
29
30
31
32 /***
33 * to be embedded inside a linkURL-element, as shown in example below:
34 * <linkURL href="customer.jsp" table="customer" /> <position
35 * fieldName="id" value="103" /> <position fieldName="cust_lang"
36 * value="2" /> </link>
37 */
38 public class DbLinkPositionItemTag extends AbstractDbBaseHandlerTag
39 implements javax.servlet.jsp.tagext.TryCatchFinally {
40 String value;
41
42 /***
43 * DOCUMENT ME!
44 *
45 * @param string
46 */
47 public void setValue(String string) {
48 value = string;
49 }
50
51
52 /***
53 * DOCUMENT ME!
54 *
55 * @return
56 */
57 public String getValue() {
58 return value;
59 }
60
61
62 /***
63 * DOCUMENT ME!
64 */
65 public void doFinally() {
66 value = null;
67 super.doFinally();
68 }
69
70
71 /***
72 * Set up the tag with parent tag's table and link to the field. Then add
73 * the data to the enclosing linkURL tag.
74 *
75 * @return DOCUMENT ME!
76 *
77 * @throws JspException thrown when error occurs in processing the body of
78 * this method
79 */
80 public int doStartTag() throws JspException {
81 DbLinkURLTag parentTag = null;
82
83 try {
84 parentTag = (DbLinkURLTag) this.getParent();
85 } catch (Exception e) {
86 throw new JspException("DbLinkPositionItem-element must be placed inside a DbLinkURL-element!");
87 }
88
89 Table table = parentTag.getTable();
90 Field field = table.getFieldByName(getName());
91 parentTag.addPositionPart(field, getValue());
92
93 return EVAL_BODY_INCLUDE;
94 }
95 }