01: /**
02: * Licensed under the Common Development and Distribution License,
03: * you may not use this file except in compliance with the License.
04: * You may obtain a copy of the License at
05: *
06: * http://www.sun.com/cddl/
07: *
08: * Unless required by applicable law or agreed to in writing, software
09: * distributed under the License is distributed on an "AS IS" BASIS,
10: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
11: * implied. See the License for the specific language governing
12: * permissions and limitations under the License.
13: */package com.sun.facelets.tag.ui;
14:
15: import java.io.IOException;
16:
17: import javax.el.ELException;
18: import javax.el.ValueExpression;
19: import javax.faces.FacesException;
20: import javax.faces.component.UIComponent;
21:
22: import com.sun.facelets.FaceletContext;
23: import com.sun.facelets.FaceletException;
24: import com.sun.facelets.tag.TagAttribute;
25: import com.sun.facelets.tag.TagConfig;
26: import com.sun.facelets.tag.TagHandler;
27:
28: /**
29: * @author Jacob Hookom
30: * @version $Id: ParamHandler.java,v 1.5 2005/10/30 01:35:51 jhook Exp $
31: */
32: public class ParamHandler extends TagHandler {
33:
34: private final TagAttribute name;
35:
36: private final TagAttribute value;
37:
38: /**
39: * @param config
40: */
41: public ParamHandler(TagConfig config) {
42: super (config);
43: this .name = this .getRequiredAttribute("name");
44: this .value = this .getRequiredAttribute("value");
45: }
46:
47: /*
48: * (non-Javadoc)
49: *
50: * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext,
51: * javax.faces.component.UIComponent)
52: */
53: public void apply(FaceletContext ctx, UIComponent parent)
54: throws IOException, FacesException, FaceletException,
55: ELException {
56: String nameStr = this .name.getValue(ctx);
57: ValueExpression valueVE = this .value.getValueExpression(ctx,
58: Object.class);
59: ctx.getVariableMapper().setVariable(nameStr, valueVE);
60: }
61:
62: }
|