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 net.smartlab.web.page; |
25 |
|
|
26 |
|
import java.io.Writer; |
27 |
|
|
28 |
|
import javax.servlet.jsp.JspException; |
29 |
|
import javax.servlet.jsp.JspTagException; |
30 |
|
|
31 |
|
import net.smartlab.web.EmptyMarkerTag; |
32 |
|
|
33 |
|
import org.apache.commons.beanutils.BeanUtils; |
34 |
|
import org.apache.struts.taglib.TagUtils; |
35 |
|
import org.apache.struts.taglib.html.Constants; |
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
@author |
41 |
|
|
42 |
|
|
|
|
| 0% |
Uncovered Elements: 38 (38) |
Complexity: 14 |
Complexity Density: 0,61 |
|
43 |
|
public class ReminderTag extends AbstractTag { |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
private String property; |
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
private String value; |
54 |
|
|
55 |
|
|
56 |
|
@param |
57 |
|
|
58 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
59 |
0
|
public void setValue(String value) {... |
60 |
0
|
this.value = value; |
61 |
|
} |
62 |
|
|
63 |
|
|
64 |
|
@param |
65 |
|
|
66 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
67 |
0
|
public void setProperty(String property) {... |
68 |
0
|
this.property = property; |
69 |
|
} |
70 |
|
|
71 |
|
|
72 |
|
@see |
73 |
|
|
|
|
| 0% |
Uncovered Elements: 33 (33) |
Complexity: 12 |
Complexity Density: 0,57 |
|
74 |
0
|
public int doStartTag() throws JspException {... |
75 |
0
|
String[] items = null; |
76 |
0
|
try { |
77 |
0
|
String[] values = (String[])TagUtils.getInstance().lookup(super.context, Constants.BEAN_KEY, property, null); |
78 |
0
|
items = new String[values.length]; |
79 |
0
|
System.arraycopy(values, 0, items, 0, items.length); |
80 |
|
} catch (Exception e) { |
81 |
|
items = context.getRequest().getParameterValues(property); |
82 |
|
} |
83 |
0
|
if (items != null) { |
84 |
0
|
try { |
85 |
0
|
Paginator paginator = super.getPaginator(); |
86 |
0
|
paginator.reset(); |
87 |
0
|
while (paginator.hasNext()) { |
88 |
0
|
Object item = BeanUtils.getProperty(paginator.next(), value); |
89 |
0
|
for (int i = 0; i < items.length; i++) { |
90 |
0
|
if (item != null && items[i] != null && (items[i].equals(EmptyMarkerTag.EMPTY_MARKER) || items[i].equals(item.toString()))) { |
91 |
0
|
items[i] = null; |
92 |
0
|
break; |
93 |
|
} |
94 |
|
} |
95 |
|
} |
96 |
0
|
paginator.reset(); |
97 |
0
|
Writer out = context.getOut(); |
98 |
0
|
for (int i = 0; i < items.length; i++) { |
99 |
0
|
if (items[i] != null) { |
100 |
0
|
out.write("<input type=\"hidden\" name=\"" + property + "\" value=\"" + items[i] + "\"/>"); |
101 |
|
} |
102 |
|
} |
103 |
|
} catch (Exception e) { |
104 |
|
throw new JspTagException(e); |
105 |
|
} |
106 |
|
} |
107 |
0
|
return EVAL_PAGE; |
108 |
|
} |
109 |
|
} |