1
2
3
4
5 package ecar.taglib.teste;
6
7 import java.io.IOException;
8
9 import javax.servlet.jsp.JspException;
10 import javax.servlet.jsp.JspWriter;
11 import javax.servlet.jsp.PageContext;
12 import javax.servlet.jsp.tagext.Tag;
13
14
15
16
17
18 public class TagPai implements Tag{
19
20 private String label;
21
22 private PageContext page = null;
23
24
25
26
27
28
29
30
31
32
33 public int doStartTag() throws JspException {
34 JspWriter writer = this.page.getOut();
35 StringBuffer s = new StringBuffer();
36 s.append(getLabel()).append(": <BR>");
37 try {
38 writer.print(s.toString());
39 } catch (IOException e) {
40 org.apache.log4j.Logger.getLogger(this.getClass()).error(e);
41 }
42 return Tag.EVAL_BODY_INCLUDE;
43 }
44
45
46
47
48
49
50
51
52
53 public void setPageContext(PageContext arg0) {
54 this.page = arg0;
55 }
56
57
58
59
60
61
62
63
64
65 public void setParent(Tag arg0) {
66 }
67
68
69
70
71
72
73
74
75
76 public Tag getParent() {
77 return null;
78 }
79
80
81
82
83
84
85
86
87
88
89 public int doEndTag() throws JspException {
90 JspWriter writer = this.page.getOut();
91 StringBuffer s = new StringBuffer();
92 s.append(" TERMINOU!");
93 try {
94 writer.print(s.toString());
95 } catch (IOException e) {
96 org.apache.log4j.Logger.getLogger(this.getClass()).error(e);
97 }
98 return Tag.EVAL_PAGE;
99 }
100
101
102
103
104
105
106 public void release() {
107 }
108
109
110
111
112
113
114
115
116
117 public PageContext getPage() {
118 return page;
119 }
120
121
122
123
124
125
126
127
128 public void setPage(PageContext page) {
129 this.page = page;
130 }
131
132
133
134
135
136
137
138
139
140 public String getLabel() {
141 return label;
142 }
143
144
145
146
147
148
149
150
151 public void setLabel(String label) {
152 this.label = label;
153 }
154 }