On Mon, 28 Jan 2002, Wolfgang Röckelein wrote:

> how do I access session scoped variables from expression language in the
> standard taglib library?

The answer depends on the actual expression language you use.  EA3 doesn't
define just a single expression language; instead, it lets you plug in
various experimental ones.  The expert group decided on this approach for
the early-access RI to encourage testing and feedback.  The final version
of JSTL will use a stable, easy-to-use expression language.

Having said that, in JSTL EA3 by default, you can access session-scoped
attributes simply by using their names.  To access 'foo' in session scope,
for instance, just use the following expression:

  $foo

Technically, JSP's scopes represent a single namespace, so if you have
'foo' in session scope, you couldn't have it in request or application
scope as well.  However, in practice, this isn't widely enforced, so make
sure you don't have a 'foo' attribute in page or request scope before
using the expression above (as these two scopes are higher 'priority' than
session).

> And, btw, what is with request scoped, apllication scoped, etc.
> variables?

JSP supports multiple scopes to give page authors more control over the
lifecycle of their data.  For example, request scope applies to all pages
used to service the current request (e.g., through <c:import> or
<jsp:forward> tags).  Application scope applies to the whole application.  
In EA3's default experimental langauge, all scopes are accessed using the
same syntax:  $name.

EA3 also comes with a language called SPEL that lets you access scopes
specifically:

  $session:foo
  $request:foo

and so on.

--
Shawn Bayern
JSTL reference-implementation lead
Author, "JSP Standard Tag Library" (Manning,upcoming)  http://jstlbook.com


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to