📄 package-summary.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.5.0_14) on Mon Jan 28 05:47:08 PST 2008 --><TITLE>javax.servlet.jsp.el (Java EE 5)</TITLE><META NAME="keywords" CONTENT="javax.servlet.jsp.el package"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="javax.servlet.jsp.el (Java EE 5)";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../javax/servlet/jsp/package-summary.html"><B>PREV PACKAGE</B></A> <A HREF="../../../../javax/servlet/jsp/tagext/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?javax/servlet/jsp/el/package-summary.html" target="_top"><B>FRAMES</B></A> <A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><H2>Package javax.servlet.jsp.el</H2>Provides the <code>ELResolver</code> classes that define theobject resolution rules that must be supported by a JSP container with the new unified Expression Language.<P><B>See:</B><BR> <A HREF="#package_description"><B>Description</B></A><P><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Interface Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD WIDTH="15%"><B><A HREF="../../../../javax/servlet/jsp/el/FunctionMapper.html" title="interface in javax.servlet.jsp.el">FunctionMapper</A></B></TD><TD><B>Deprecated.</B> <I>As of JSP 2.1, replaced by <A HREF="../../../../javax/el/FunctionMapper.html" title="class in javax.el"><CODE>FunctionMapper</CODE></A></I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD WIDTH="15%"><B><A HREF="../../../../javax/servlet/jsp/el/VariableResolver.html" title="interface in javax.servlet.jsp.el">VariableResolver</A></B></TD><TD><B>Deprecated.</B> <I>As of JSP 2.1, replaced by <A HREF="../../../../javax/el/ELResolver.html" title="class in javax.el"><CODE>ELResolver</CODE></A></I></TD></TR></TABLE> <P><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Class Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD WIDTH="15%"><B><A HREF="../../../../javax/servlet/jsp/el/Expression.html" title="class in javax.servlet.jsp.el">Expression</A></B></TD><TD><B>Deprecated.</B> <I>As of JSP 2.1, replaced by <A HREF="../../../../javax/el/ValueExpression.html" title="class in javax.el"><CODE>ValueExpression</CODE></A></I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD WIDTH="15%"><B><A HREF="../../../../javax/servlet/jsp/el/ExpressionEvaluator.html" title="class in javax.servlet.jsp.el">ExpressionEvaluator</A></B></TD><TD><B>Deprecated.</B> <I>As of JSP 2.1, replaced by <A HREF="../../../../javax/el/ExpressionFactory.html" title="class in javax.el"><CODE>ExpressionFactory</CODE></A></I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD WIDTH="15%"><B><A HREF="../../../../javax/servlet/jsp/el/ImplicitObjectELResolver.html" title="class in javax.servlet.jsp.el">ImplicitObjectELResolver</A></B></TD><TD>Defines variable resolution behavior for the EL implicit objects defined in the JSP specification.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD WIDTH="15%"><B><A HREF="../../../../javax/servlet/jsp/el/ScopedAttributeELResolver.html" title="class in javax.servlet.jsp.el">ScopedAttributeELResolver</A></B></TD><TD>Defines variable resolution behavior for scoped attributes.</TD></TR></TABLE> <P><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Exception Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD WIDTH="15%"><B><A HREF="../../../../javax/servlet/jsp/el/ELException.html" title="class in javax.servlet.jsp.el">ELException</A></B></TD><TD><B>Deprecated.</B> <I>As of JSP 2.1, replaced by <A HREF="../../../../javax/el/ELException.html" title="class in javax.el"><CODE>ELException</CODE></A></I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD WIDTH="15%"><B><A HREF="../../../../javax/servlet/jsp/el/ELParseException.html" title="class in javax.servlet.jsp.el">ELParseException</A></B></TD><TD><B>Deprecated.</B> <I>As of JSP 2.1, replaced by <A HREF="../../../../javax/el/ELException.html" title="class in javax.el"><CODE>ELException</CODE></A></I></TD></TR></TABLE> <P><A NAME="package_description"><!-- --></A><H2>Package javax.servlet.jsp.el Description</H2><P>Provides the <code>ELResolver</code> classes that define theobject resolution rules that must be supported by a JSP container with the new unified Expression Language.<p>The package also defines programmatic access to the old Expression Language evaluator (pre JSP 2.1).<p><b>Please notethat as of JSP 2.1, all classes and interfaces that were in package<code>javax.servlet.jsp.el</code> have been deprecated in favor of the new unifiedExpression Language APIs (<code>javax.el</code>). See the Expression Languagespecification document for more details.</b> </p><p><b>While a JSP container must still support the deprecated APIs definedin <code>javax.servlet.jsp.el</code>, developers should only rely on the new <code>javax.el</code> APIsfor new development work.</b></p><p>Two ELResolver classes have been added in JSP 2.1 to implementobject resolution rules that must be supported by a JSP container with the new unified Expression Language: <A HREF="../../../../javax/servlet/jsp/el/ImplicitObjectELResolver.html" title="class in javax.servlet.jsp.el"><CODE>ImplicitObjectELResolver</CODE></A> and <A HREF="../../../../javax/servlet/jsp/el/ScopedAttributeELResolver.html" title="class in javax.servlet.jsp.el"><CODE>ScopedAttributeELResolver</CODE></A>. </p><h2>Documentation on the old and deprecated API</h2><p>The JavaServer Pages(tm) (JSP) 2.0 specification provides a portableAPI for evaluating "EL Expressions". As of JSP 2.0, EL expressions canbe placed directly in the template text of JSP pages and tag files.<p>This package contains a number of classes and interfaces that describe and define programmatic access to the Expression Language evaluator. This API can also be used by an implementation of JSP to evaluate the expressions, but other implementations, like open-coding into Java bytecodes, are allowed. This package is intended to have no dependencies on other portions of the JSP 2.0 specification. <h3>Expression Evaluator</h3>Programmatic access to the EL Expression Evaluator is providedthrough the following types:<ul> <li><code>ExpressionEvaluator</code></li> <li><code>Expression</code></li> <li><code>FunctionMapper</code></li> <li><code>VariableResolver</code></li></ul><p> An <code>ExpressionEvaluator</code> object can be obtained from aJspContext object through the <code>getExpressionEvaluator</code>method. An ExpressionEvaluator encapsulates the EL processor. An ELexpression provided as a String can then be evaluated directly, or itcan be parsed first into an <code>Expression</code> object. The parsestep, can be used to factor out the cost of parsing the expression, oreven the cost of optimizing the implementation.</p><p>The parsing of an expression string is done against a target type,a default prefix (that applies when a function has no prefix), anda <code>FunctionMapper</code>. The <code>FunctionMapper</code> objectmaps a prefix and a local name part into a<code>java.lang.reflect.Method</code> object.</p><p>The interpretation or evaluation of a parsed expression is doneusing a <code>VariableResolver</code> object. This object resolvestop level object names into Objects. A <code>VariableResolver</code>can be obtained from a <code>JspContext</code> object through the<code>getVariableResolver</code> method.</p><h3>Exceptions</h3><p>The <code>ELException</code> exception is used by the expressionlanguage to denote any exception that may arise during the parsing orevaluation of an expression.The <code>ELParseException</code> exception is a subclass of<code>ELException</code> that corresponds to parsing errors</p><p>Parsing errors are conveyed as exceptions to simplify the API. Itis expected that many JSP containers will use additional mechanisms toparse EL expressions and report their errors - a run-time API cannotprovide accurate line-error numbers without additional machinery.</p><h3>Code Fragment</h3><p>Below is a non-normative code fragment outlining how the APIs can be used.</p><pre>// Get an instance of an ExpressionEvaluatorExpressionEvaluator ee = myJspContext.getExpressionEvaluator();VariableResolver vr = myJspContext.getVariableResolver();FunctionMapper fm; // we don't have a portable implementation yet// Example of compiling an expression. See [ISSUE-2]// Errors detected this way may have higher quality than those// found with a simple validate() invocation.ExpressionCompilation ce;try { ce = ee.prepareExpression(expr, targetClass, fm, null // no prefixes );} catch (ELParseException e) { log (e.getMessage());}try { ce.evaluate(vr);} catch (ElException e) { log (e);}</pre><P><P><DL></DL><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../javax/servlet/jsp/package-summary.html"><B>PREV PACKAGE</B></A> <A HREF="../../../../javax/servlet/jsp/tagext/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?javax/servlet/jsp/el/package-summary.html" target="_top"><B>FRAMES</B></A> <A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR><font size="-1"><a href="http://java.sun.com/webapps/bugreport">Submit a bug or feature</a> <p>Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to <a href="../legal/license.html" target="_top">license terms.</a></font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -