|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| package com.opensymphony.oscache.web.tag; |
|
6 |
| |
|
7 |
| import javax.servlet.jsp.JspTagException; |
|
8 |
| import javax.servlet.jsp.tagext.TagSupport; |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| public class UseCachedTag extends TagSupport { |
|
32 |
| boolean use = true; |
|
33 |
| |
|
34 |
| |
|
35 |
| |
|
36 |
| |
|
37 |
| |
|
38 |
| |
|
39 |
0
| public void setUse(boolean value) {
|
|
40 |
0
| this.use = value;
|
|
41 |
| } |
|
42 |
| |
|
43 |
| |
|
44 |
| |
|
45 |
| |
|
46 |
| |
|
47 |
| |
|
48 |
| |
|
49 |
0
| public int doStartTag() throws JspTagException {
|
|
50 |
0
| CacheTag cacheTag = (CacheTag) TagSupport.findAncestorWithClass(this, CacheTag.class);
|
|
51 |
| |
|
52 |
0
| if (cacheTag == null) {
|
|
53 |
0
| throw new JspTagException("A UseCached tag must be nested within a Cache tag");
|
|
54 |
| } |
|
55 |
| |
|
56 |
0
| cacheTag.setUseBody(!use);
|
|
57 |
| |
|
58 |
0
| return SKIP_BODY;
|
|
59 |
| } |
|
60 |
| } |