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 @Override
82 public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
83 ELException
84 {
85 String nameStr = getName(ctx);
86 ValueExpression valueVE = getValue(ctx);
87
88 apply(ctx, parent, nameStr, valueVE);
89 }
90
91 public void apply(FaceletContext ctx, UIComponent parent, String nameStr, ValueExpression valueVE)
92 throws IOException, FacesException, FaceletException, ELException
93 {
94 ctx.getVariableMapper().setVariable(nameStr, valueVE);
95 AbstractFaceletContext actx = ((AbstractFaceletContext) ctx);
96 actx.getTemplateContext().setAllowCacheELExpressions(false);
97 }
98
99 public String getName(FaceletContext ctx)
100 {
101 return this.name.getValue(ctx);
102 }
103
104 public ValueExpression getValue(FaceletContext ctx)
105 {
106 return this.value.getValueExpression(ctx, Object.class);
107 }
108 }