KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > facelets > tag > ui > ParamHandler


1 /**
2  * Licensed under the Common Development and Distribution License,
3  * you may not use this file except in compliance with the License.
4  * You may obtain a copy of the License at
5  *
6  * http://www.sun.com/cddl/
7  *
8  * Unless required by applicable law or agreed to in writing, software
9  * 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  */

14
15 package com.sun.facelets.tag.ui;
16
17 import java.io.IOException JavaDoc;
18
19 import javax.el.ELException;
20 import javax.el.ValueExpression;
21 import javax.faces.FacesException;
22 import javax.faces.component.UIComponent;
23
24 import com.sun.facelets.FaceletContext;
25 import com.sun.facelets.FaceletException;
26 import com.sun.facelets.tag.TagAttribute;
27 import com.sun.facelets.tag.TagConfig;
28 import com.sun.facelets.tag.TagHandler;
29
30 /**
31  * @author Jacob Hookom
32  * @version $Id: ParamHandler.java,v 1.5 2005/10/30 01:35:51 jhook Exp $
33  */

34 public class ParamHandler extends TagHandler {
35
36     private final TagAttribute name;
37
38     private final TagAttribute value;
39
40     /**
41      * @param config
42      */

43     public ParamHandler(TagConfig config) {
44         super(config);
45         this.name = this.getRequiredAttribute("name");
46         this.value = this.getRequiredAttribute("value");
47     }
48
49     /*
50      * (non-Javadoc)
51      *
52      * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext,
53      * javax.faces.component.UIComponent)
54      */

55     public void apply(FaceletContext ctx, UIComponent parent)
56             throws IOException JavaDoc, FacesException, FaceletException, ELException {
57         String JavaDoc nameStr = this.name.getValue(ctx);
58         ValueExpression valueVE = this.value.getValueExpression(ctx,
59                 Object JavaDoc.class);
60         ctx.getVariableMapper().setVariable(nameStr, valueVE);
61     }
62
63 }
64
Popular Tags