1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.extremecomponents.table.tag;
17
18 import javax.servlet.jsp.JspException;
19 import javax.servlet.jsp.tagext.BodyTagSupport;
20
21 import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;
22
23
24 /***
25 * Append any attributes to the Sorting, Filtering, Pagination, and Form Submission.
26 * On the URL's will resolve to &name=value.
27 * On the <form> attribute will be added as hidden fields
28 * <input type=hidden name= value=>
29 *
30 * @author Jeff Johnston
31 */
32 public class ParameterTag extends BodyTagSupport
33 {
34 private String name;
35 private String value;
36
37 public String getName()
38 {
39 return name;
40 }
41
42 public void setName(String name)
43 {
44 this.name = name;
45 }
46
47 public String getValue()
48 {
49 return value;
50 }
51
52 public void setValue(String value)
53 {
54 this.value = value;
55 }
56
57 public int doEndTag()
58 throws JspException
59 {
60 TableTag tableTag = (TableTag) findAncestorWithClass(this, TableTag.class);
61
62 if (tableTag.getModelRowsSize() > 0)
63 {
64 return EVAL_PAGE;
65 }
66
67 if (this.bodyContent != null)
68 {
69 value = getBodyContent().getString();
70 }
71
72 if (value != null)
73 {
74 value = (String) ExpressionEvaluatorManager.evaluate("value", value.toString(), String.class, this, pageContext);
75 }
76
77 tableTag.addParameter(name, value);
78
79 cleanup();
80
81 return EVAL_PAGE;
82 }
83
84 public void cleanup()
85 {
86 name = null;
87 value = null;
88 setBodyContent(null);
89 }
90 }