|
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 | ||||||||
javax.servlet.jsp Interface JspApplicationContext
public interface JspApplicationContext
Stores application-scoped information relevant to JSP containers.
The JSP container must create a single instance of
JspApplicationContext for each
ServletContext instance.
An instance of JspApplicationContext is obtained by
invoking the static JspFactory.getJspApplicationContext(javax.servlet.ServletContext) method,
passing the ServletContext of the corresponding web
application.
The JspApplicationContext provides the following services
to JSP applications:
- Allows registration of
ELResolvers, which are used to resolve variables in EL expressions contained in JSP pages and tag files. - Provides an instance of
ExpressionFactoryfor those applications or frameworks that need to perform programmatic evaluation of EL expressions instead of allowing the JSP container to do it for them. - Allows the attachment of
ELContextListenerinstances for notification whenever a newELContextis created. This is necessary when an application wishes to make custom context objects available to their pluggableELResolvers.
- 从以下版本开始:
- JSP 2.1
- 另请参见:
ServletContext,JspFactory,ELResolver,ExpressionFactory,ELContextListener
| 方法摘要 | |
|---|---|
void |
addELContextListener(ELContextListener listener)
Registers a ELContextListeners so that context objects
can be added whenever a new ELContext is created. |
void |
addELResolver(ELResolver resolver)
Adds an ELResolver to affect the way EL variables
and properties are resolved for EL expressions appearing in JSP pages
and tag files. |
ExpressionFactory |
getExpressionFactory()
Returns a factory used to create ValueExpressions and
MethodExpressions so that EL expressions can be
parsed and evaluated. |
| 方法详细信息 |
|---|
addELResolver
void addELResolver(ELResolver resolver)
- Adds an
ELResolverto affect the way EL variables and properties are resolved for EL expressions appearing in JSP pages and tag files.For example, in the EL expression ${employee.lastName}, an
ELResolverdetermines what object "employee" references and how to find its "lastName" property.When evaluating an expression, the JSP container will consult a set of standard resolvers as well as any resolvers registered via this method. The set of resolvers are consulted in the following order:
ImplicitObjectELResolverELResolvers registered via this method, in the order in which they are registered.MapELResolverListELResolverArrayELResolverBeanELResolverScopedAttributeELResolver
It is illegal to register an
This restriction is in place to allow the JSP container to optimize for the common case where no additionalELResolverafter the application has received any request from the client. If an attempt is made to register anELResolverafter that time, anIllegalStateExceptionis thrown.ELResolvers are in the chain, aside from the standard ones. It is permissible to addELResolvers before or after initialization to aCompositeELResolverthat is already in the chain.
It is not possible to remove an ELResolver registered
with this method, once it has been registered.
- 参数:
resolver- The newELResolver- 抛出异常:
IllegalStateException- if an attempt is made to call this method after allServletContextListeners have had theircontextInitializedmethods invoked.
getExpressionFactory
ExpressionFactory getExpressionFactory()
- Returns a factory used to create
ValueExpressions andMethodExpressions so that EL expressions can be parsed and evaluated. - 返回:
- A concrete implementation of the
an
ExpressionFactory.
addELContextListener
void addELContextListener(ELContextListener listener)
- Registers a
ELContextListeners so that context objects can be added whenever a newELContextis created.At a minimum, the
ELContextobjects created will contain a reference to theJspContextfor this request, which is added by the JSP container. This is sufficient for all the defaultELResolvers listed inaddELResolver(javax.el.ELResolver). Note thatJspContext.classis used as the key to ELContext.putContext() for theJspContextobject reference.This method is generally used by frameworks and applications that register their own
ELResolverthat needs context other thanJspContext. The listener will typically add the necessary context to theELContextprovided in the event object. Registering a listener that adds context allows theELResolvers in the stack to access the context they need when they do a resolution. - 参数:
listener- The listener to be notified when a newELContextis created.
|
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 | ||||||||
提交错误或意见
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.