-
public interface JspApplicationContext
Stores application-scoped information relevant to JSP containers.The JSP container must create a single instance of
JspApplicationContext
for eachServletContext
instance.An instance of
JspApplicationContext
is obtained by invoking the staticJspFactory.getJspApplicationContext(javax.servlet.ServletContext)
method, passing theServletContext
of the corresponding web application.The
JspApplicationContext
provides the following services to JSP applications:- Allows registration of
ELResolver
s, which are used to resolve variables in EL expressions contained in JSP pages and tag files. - Provides an instance of
ExpressionFactory
for 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
ELContextListener
instances for notification whenever a newELContext
is created. This is necessary when an application wishes to make custom context objects available to their pluggableELResolver
s.
- Since:
- JSP 2.1
- See Also:
ServletContext
,JspFactory
,ELResolver
,ExpressionFactory
,ELContextListener
- Allows registration of
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description void
addELContextListener(ELContextListener listener)
Registers aELContextListener
s so that context objects can be added whenever a newELContext
is created.void
addELResolver(ELResolver resolver)
Adds anELResolver
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 createValueExpression
s andMethodExpression
s so that EL expressions can be parsed and evaluated.
-
-
-
Method Detail
-
addELResolver
void addELResolver(ELResolver resolver)
Adds anELResolver
to 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
ELResolver
determines 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:
ImplicitObjectELResolver
ELResolver
s registered via this method, in the order in which they are registered.MapELResolver
ListELResolver
ArrayELResolver
BeanELResolver
ScopedAttributeELResolver
It is illegal to register an
This restriction is in place to allow the JSP container to optimize for the common case where no additionalELResolver
after the application has received any request from the client. If an attempt is made to register anELResolver
after that time, anIllegalStateException
is thrown.ELResolver
s are in the chain, aside from the standard ones. It is permissible to addELResolver
s before or after initialization to aCompositeELResolver
that is already in the chain.It is not possible to remove an
ELResolver
registered with this method, once it has been registered.- Parameters:
resolver
- The newELResolver
- Throws:
IllegalStateException
- if an attempt is made to call this method after allServletContextListener
s have had theircontextInitialized
methods invoked.
-
getExpressionFactory
ExpressionFactory getExpressionFactory()
Returns a factory used to createValueExpression
s andMethodExpression
s so that EL expressions can be parsed and evaluated.- Returns:
- A concrete implementation of the
an
ExpressionFactory
.
-
addELContextListener
void addELContextListener(ELContextListener listener)
Registers aELContextListener
s so that context objects can be added whenever a newELContext
is created.At a minimum, the
ELContext
objects created will contain a reference to theJspContext
for this request, which is added by the JSP container. This is sufficient for all the defaultELResolver
s listed inaddELResolver(javax.el.ELResolver)
. Note thatJspContext.class
is used as the key to ELContext.putContext() for theJspContext
object reference.This method is generally used by frameworks and applications that register their own
ELResolver
that needs context other thanJspContext
. The listener will typically add the necessary context to theELContext
provided in the event object. Registering a listener that adds context allows theELResolver
s in the stack to access the context they need when they do a resolution.- Parameters:
listener
- The listener to be notified when a newELContext
is created.
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 18/08/2025 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-javaee-rf-javax/servlet/jsp/JspApplicationContext.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.