1
2
3
4 package org.apache.tiles.jsp.taglib;
5
6 import java.io.IOException;
7
8 import javax.servlet.jsp.JspException;
9 import javax.servlet.jsp.tagext.SimpleTagSupport;
10
11 import org.apache.tiles.autotag.core.runtime.ModelBody;
12 import org.apache.tiles.autotag.core.runtime.AutotagRuntime;
13
14
15
16
17
18
19
20
21
22
23 public class DefinitionTag extends SimpleTagSupport {
24
25
26
27
28 private org.apache.tiles.template.DefinitionModel model = new org.apache.tiles.template.DefinitionModel();
29
30
31
32
33
34 private java.lang.String name;
35
36
37
38
39 private java.lang.String template;
40
41
42
43
44
45 private java.lang.String role;
46
47
48
49
50 private java.lang.String extendsParam;
51
52
53
54
55
56 private java.lang.String preparer;
57
58
59
60
61
62
63
64
65 public java.lang.String getName() {
66 return name;
67 }
68
69
70
71
72
73
74
75
76 public void setName(java.lang.String name) {
77 this.name = name;
78 }
79
80
81
82
83
84
85
86 public java.lang.String getTemplate() {
87 return template;
88 }
89
90
91
92
93
94
95
96 public void setTemplate(java.lang.String template) {
97 this.template = template;
98 }
99
100
101
102
103
104
105
106
107 public java.lang.String getRole() {
108 return role;
109 }
110
111
112
113
114
115
116
117
118 public void setRole(java.lang.String role) {
119 this.role = role;
120 }
121
122
123
124
125
126
127
128 public java.lang.String getExtends() {
129 return extendsParam;
130 }
131
132
133
134
135
136
137
138 public void setExtends(java.lang.String extendsParam) {
139 this.extendsParam = extendsParam;
140 }
141
142
143
144
145
146
147
148
149 public java.lang.String getPreparer() {
150 return preparer;
151 }
152
153
154
155
156
157
158
159
160 public void setPreparer(java.lang.String preparer) {
161 this.preparer = preparer;
162 }
163
164
165 @Override
166 public void doTag() throws JspException, IOException {
167 AutotagRuntime<org.apache.tiles.request.Request> runtime = new org.apache.tiles.request.jsp.autotag.JspAutotagRuntime();
168 if (runtime instanceof SimpleTagSupport) {
169 SimpleTagSupport tag = (SimpleTagSupport) runtime;
170 tag.setJspContext(getJspContext());
171 tag.setJspBody(getJspBody());
172 tag.setParent(getParent());
173 tag.doTag();
174 }
175 org.apache.tiles.request.Request request = runtime.createRequest();
176 ModelBody modelBody = runtime.createModelBody();
177 model.execute(
178 name,
179 template,
180 role,
181 extendsParam,
182 preparer,
183 request, modelBody
184 );
185 }
186 }