1
2
3
4
5 package ecar.taglib.util;
6
7 import javax.servlet.jsp.JspException;
8 import javax.servlet.jsp.JspWriter;
9 import javax.servlet.jsp.tagext.Tag;
10 import javax.servlet.jsp.tagext.TagSupport;
11
12 import org.apache.log4j.Logger;
13
14
15
16
17
18
19 public class BarraPesquisaTag extends TagSupport {
20
21
22
23
24 private static final long serialVersionUID = 8613849191957082475L;
25
26 private Logger logger = Logger.getLogger(this.getClass());
27
28
29
30
31
32
33 private int atual;
34 private int total;
35
36
37
38
39
40
41
42
43
44
45 public int doStartTag() throws JspException {
46 JspWriter writer = this.pageContext.getOut();
47
48 try {
49 writer.println("<table class=\"barrabotoes\" cellpadding=\"0\" cellspacing=\"0\">");
50 writer.println("<tr>");
51
52 writer.println("<td width=\"20%\" align=\"left\">");
53 writer.println("<input name=\"btnPrimeiro\" type=\"button\" value=\"<<\" class=\"botao\" onclick=\"aoClicarPrimeiro(form);\">");
54 writer.println("<input name=\"btnAnterior\" type=\"button\" value=\"<\" class=\"botao\" onclick=\"aoClicarAnterior(form);\">");
55 writer.println("</td>");
56
57 writer.println("<td align=\"center\" width=\"60%\">");
58 if (this.getAtual() != 0)
59 writer.print("Página " + this.getAtual());
60
61 if (this.getTotal() != 0) {
62 if (this.getAtual() != 0)
63 writer.print(" de ");
64 writer.println(this.getTotal());
65 }
66 writer.println("</td>");
67
68
69 writer.println("<td width=\"20%\" align=\"right\">");
70 writer.println("<input name=\"btnProximo\" type=\"button\" value=\">\" class=\"botao\" onclick=\"aoClicarProximo(form);\">");
71 writer.println("<input name=\"btnUltimo\" type=\"button\" value=\">>\" class=\"botao\" onclick=\"aoClicarUltimo(form);\">");
72 writer.println("</td>");
73
74 writer.println("</tr>");
75 writer.println("</table>");
76 } catch (Exception e) {
77 logger.error(e);
78 }
79
80 return Tag.SKIP_BODY;
81 }
82
83
84
85
86
87
88
89
90
91
92 public int doEndTag() throws JspException {
93
94 return Tag.EVAL_PAGE;
95 }
96
97
98
99
100
101
102
103
104
105 public int getAtual() {
106 return atual;
107 }
108
109
110
111
112
113
114
115
116
117 public void setAtual(int atual) {
118 this.atual = atual;
119 }
120
121
122
123
124
125
126
127
128
129 public int getTotal() {
130 return total;
131 }
132
133
134
135
136
137
138
139
140
141 public void setTotal(int total) {
142 this.total = total;
143 }
144 }