1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.myfaces.view.facelets.tag.ui;
21
22 import java.io.IOException;
23 import javax.el.ELException;
24 import javax.el.ValueExpression;
25 import javax.faces.FacesException;
26 import javax.faces.component.UIComponent;
27 import javax.faces.view.facelets.FaceletContext;
28 import javax.faces.view.facelets.FaceletException;
29 import javax.faces.view.facelets.TagAttribute;
30 import javax.faces.view.facelets.TagConfig;
31 import javax.faces.view.facelets.TagHandler;
32 import org.apache.myfaces.view.facelets.AbstractFaceletContext;
33
34
35
36
37
38
39
40
41
42
43
44 public class LegacyParamHandler extends TagHandler
45 {
46
47
48
49
50
51
52
53
54 private final TagAttribute name;
55
56
57
58
59
60
61
62
63 private final TagAttribute value;
64
65
66
67
68 public LegacyParamHandler(TagConfig config)
69 {
70 super(config);
71 this.name = this.getRequiredAttribute("name");
72 this.value = this.getRequiredAttribute("value");
73 }
74
75
76
77
78
79
80
81 public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
82 ELException
83 {
84 String nameStr = getName(ctx);
85 ValueExpression valueVE = getValue(ctx);
86
87 apply(ctx, parent, nameStr, valueVE);
88 }
89
90 public void apply(FaceletContext ctx, UIComponent parent, String nameStr, ValueExpression valueVE)
91 throws IOException, FacesException, FaceletException, ELException
92 {
93 ctx.getVariableMapper().setVariable(nameStr, valueVE);
94 AbstractFaceletContext actx = ((AbstractFaceletContext) ctx);
95 actx.getTemplateContext().setAllowCacheELExpressions(false);
96 }
97
98 public String getName(FaceletContext ctx)
99 {
100 return this.name.getValue(ctx);
101 }
102
103 public ValueExpression getValue(FaceletContext ctx)
104 {
105 return this.value.getValueExpression(ctx, Object.class);
106 }
107 }