You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by "David N. Foote" <da...@pervasent.com> on 2003/06/09 07:41:18 UTC

why can't I access implicit object properties in EL

I would expect <c:out value="${session.id}"/> to produce the same output as
<% out.write(session.getId()); %>.
But there is no output from the former.  Can anyone explain this?  The same
thing applies to request.requestURL.

David Foote


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: why can't I access implicit object properties in EL

Posted by Jon Archer <jo...@perceptive.com>.
Maybe something else is wrong, e.g. the session scope variable is not
being set or you have a dodgy config.

Are you able to do a simple <c:set var="test" value="Guinness" /> and
output with a <c:out value="${test}" /> ?

On Mon, 2003-06-09 at 00:08, David N. Foote wrote:
> I gave that a try, but no dice.
> 
> ----- Original Message ----- 
> From: "Jon Archer" <jo...@perceptive.com>
> To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
> Sent: Sunday, June 08, 2003 10:50 PM
> Subject: Re: why can't I access implicit object properties in EL
> 
> 
> > try <c:out value="${sessionScope.id}" />
> >
> > and similarly requestScope.something
> >
> >



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: why can't I access implicit object properties in EL

Posted by "David N. Foote" <da...@pervasent.com>.
I gave that a try, but no dice.

----- Original Message ----- 
From: "Jon Archer" <jo...@perceptive.com>
To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
Sent: Sunday, June 08, 2003 10:50 PM
Subject: Re: why can't I access implicit object properties in EL


> try <c:out value="${sessionScope.id}" />
>
> and similarly requestScope.something
>
>
> On Sun, 2003-06-08 at 23:41, David N. Foote wrote:
> > I would expect <c:out value="${session.id}"/> to produce the same output
as
> > <% out.write(session.getId()); %>.
> > But there is no output from the former.  Can anyone explain this?  The
same
> > thing applies to request.requestURL.
> >
> > David Foote
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: why can't I access implicit object properties in EL

Posted by "David N. Foote" <da...@pervasent.com>.
Thanks Bruce,

That works great.  I (wrongly) believed that pageScope was equivalent to
pageContext and thus JSP implicit objects like session and request were
accessible to EL without qualification.  Thanks for clearing that up. :-)

For the record, the following JSTL/JSP results in the subsequent output:

<%@page contentType="text/html"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
<head><title>JSP Page</title></head>
<body>
pageContext.session.id = <c:out value="${pageContext.session.id}" /><br>
sessionScope.id = <c:out value="${sessionScope.id}"/><br>
session.id = <c:out value="${session.id}"/><br>
session.getId() = <% out.write(session.getId()); %><br>
</body>
</html>
----------------------------------------------------------------------------
--------
pageContext.session.id = A0B07F762892D8DF8EFE6B7C41B290C5
sessionScope.id =
session.id =
session.getId() = A0B07F762892D8DF8EFE6B7C41B290C5


David Foote





----- Original Message ----- 
From: "Bruce Perry" <br...@attbi.com>
To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
Sent: Monday, June 09, 2003 4:00 AM
Subject: Re: why can't I access implicit object properties in EL


>
> Try:
>
> > <c:out value="${pageContext.session.id}" />
>
> similarly: <c:out value="${pageContext.request.requestURL}" />
>
> applicationScope, sessionScope, and requestScope are JSTL implicit
> variables that store object attributes, such as session attributes.
>
> I would get ahold of the JSTL specification and just leaf through the
> implicit objects to review what they represent.
>
> Bruce
>
>
> On Monday, June 9, 2003, at 01:50 AM, Jon Archer wrote:
>
> > try <c:out value="${sessionScope.id}" />
> >
> > and similarly requestScope.something
> >
> >
> > On Sun, 2003-06-08 at 23:41, David N. Foote wrote:
> >> I would expect <c:out value="${session.id}"/> to produce the same
> >> output as
> >> <% out.write(session.getId()); %>.
> >> But there is no output from the former.  Can anyone explain this?
> >> The same
> >> thing applies to request.requestURL.
> >>
> >> David Foote
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: why can't I access implicit object properties in EL

Posted by Bruce Perry <br...@attbi.com>.
Try:

> <c:out value="${pageContext.session.id}" />

similarly: <c:out value="${pageContext.request.requestURL}" />

applicationScope, sessionScope, and requestScope are JSTL implicit 
variables that store object attributes, such as session attributes.

I would get ahold of the JSTL specification and just leaf through the 
implicit objects to review what they represent.

Bruce


On Monday, June 9, 2003, at 01:50 AM, Jon Archer wrote:

> try <c:out value="${sessionScope.id}" />
>
> and similarly requestScope.something
>
>
> On Sun, 2003-06-08 at 23:41, David N. Foote wrote:
>> I would expect <c:out value="${session.id}"/> to produce the same 
>> output as
>> <% out.write(session.getId()); %>.
>> But there is no output from the former.  Can anyone explain this?  
>> The same
>> thing applies to request.requestURL.
>>
>> David Foote
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: why can't I access implicit object properties in EL

Posted by Jon Archer <jo...@perceptive.com>.
try <c:out value="${sessionScope.id}" />

and similarly requestScope.something


On Sun, 2003-06-08 at 23:41, David N. Foote wrote:
> I would expect <c:out value="${session.id}"/> to produce the same output as
> <% out.write(session.getId()); %>.
> But there is no output from the former.  Can anyone explain this?  The same
> thing applies to request.requestURL.
> 
> David Foote
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org