KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jasper > runtime > VariableResolverImpl


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  *
21  * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
22  *
23  * Portions Copyright Apache Software Foundation.
24  */

25
26 package org.apache.jasper.runtime;
27
28 import javax.el.ELContext;
29 import javax.el.ELResolver;
30 import javax.servlet.jsp.PageContext JavaDoc;
31 import javax.servlet.jsp.el.VariableResolver JavaDoc;
32
33
34 /**
35  * <p>This is the implementation of VariableResolver in JSP 2.0,
36  * using ELResolver in JSP2.1.
37  * It looks up variable references in the PageContext, and also
38  * recognizes references to implicit objects.
39  *
40  * @author Kin-man Chung
41  * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $
42  **/

43
44 public class VariableResolverImpl
45     implements VariableResolver JavaDoc
46 {
47     private PageContext JavaDoc pageContext;
48
49     //-------------------------------------
50
/**
51      * Constructor
52      **/

53     public VariableResolverImpl (PageContext JavaDoc pageContext) {
54         this.pageContext = pageContext;
55     }
56   
57     //-------------------------------------
58
/**
59      * Resolves the specified variable within the given context.
60      * Returns null if the variable is not found.
61      **/

62     public Object JavaDoc resolveVariable (String JavaDoc pName)
63             throws javax.servlet.jsp.el.ELException JavaDoc {
64
65         ELContext elContext = pageContext.getELContext();
66         ELResolver elResolver = elContext.getELResolver();
67         try {
68             return elResolver.getValue(elContext, null, pName);
69         } catch (javax.el.ELException ex) {
70             throw new javax.servlet.jsp.el.ELException JavaDoc();
71         }
72     }
73 }
74
Popular Tags