You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matthias Kerkhoff <ma...@BESToffers.de> on 2000/11/19 13:20:23 UTC
[Q] How to query session.isNew() with struts:logic tags
Hi all,
I need a hint, how I could query properties of implicit JSP variables
like session, request or page. I tried the following, but it didn't work:
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="if" %>
<if:equal name="<%= PageContext.SESSION %>" property="new" value="true">Session is new</if:equal>
Is this my fault, or have I (once again) found a container bug ?
Thanks for your help.
--
Matthias mailto:make@BESToffers.de
Re: [Q] How to query session.isNew() with struts:logic tags
Posted by Joe Peer <jo...@wap-force.net>.
----- Original Message -----
From: Craig R. McClanahan <Cr...@eng.sun.com>
To: <st...@jakarta.apache.org>
Sent: Monday, November 20, 2000 7:44 PM
Subject: Re: [Q] How to query session.isNew() with struts:logic tags
> Matthias Kerkhoff wrote:
>
> > Hi Joe,
> >
> > > mayby i am wrong but
> > > PageContext.SESSION is a string, so how could it expose a property
"new" ?
> >
> > It's a string. That's correct. However, I have used it as RTE to specify
> > the _name_ of a bean that has a property "new" (at least, that was my
> > intention). It's no longer important for me, I'm using java code now.
> >
>
> FYI, I am making a pass through the various TLDs, and changing
<rtexprvalue> to
> true in must cases. Please review the TLDs in the most recent daily
downloads
> and let me know if I missed your favoriate one.
>
> >
> > That leaves the question if I could expect to find the implicit page,
> > request and session objects stored in the pagecontext name table (c/w
javadoc
> > for PageContext) ?
> >
>
> At least under Tomcat, these objects are available as page scope
attributes,
> under the symbolic names like PageContext.SESSION and so on. I believe
this is
> required, but haven't had a chance to double check.
>
> >
> > Matthias (mailto:make@BESToffers.de)
>
> Craig
>
>
Re[2]: [Q] How to query session.isNew() with struts:logic tags
Posted by Matthias Kerkhoff <ma...@BESToffers.de>.
>> That leaves the question if I could expect to find the implicit page,
>> request and session objects stored in the pagecontext name table (c/w javadoc
>> for PageContext) ?
>>
> At least under Tomcat, these objects are available as page scope attributes,
> under the symbolic names like PageContext.SESSION and so on. I believe this is
> required, but haven't had a chance to double check.
Thanks - I will report this to BEA. I would also think that they should be
there.
--
Matthias (mailto:make@BESToffers.de)
Re: [Q] How to query session.isNew() with struts:logic tags
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Joe Peer wrote:
> > > > mayby i am wrong but
> > > > PageContext.SESSION is a string, so how could it expose a property
> "new" ?
>
> i was _really_ wrong !
> sorry about that
>
Not a problem. It let me brag about how smart the Struts tags can be :-).
> -joe
Craig McClanahan
Re: [Q] How to query session.isNew() with struts:logic tags
Posted by Joe Peer <jo...@wap-force.net>.
> > > mayby i am wrong but
> > > PageContext.SESSION is a string, so how could it expose a property
"new" ?
i was _really_ wrong !
sorry about that
-joe
Re: [Q] How to query session.isNew() with struts:logic tags
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Matthias Kerkhoff wrote:
> Hi Joe,
>
> > mayby i am wrong but
> > PageContext.SESSION is a string, so how could it expose a property "new" ?
>
> It's a string. That's correct. However, I have used it as RTE to specify
> the _name_ of a bean that has a property "new" (at least, that was my
> intention). It's no longer important for me, I'm using java code now.
>
FYI, I am making a pass through the various TLDs, and changing <rtexprvalue> to
true in must cases. Please review the TLDs in the most recent daily downloads
and let me know if I missed your favoriate one.
>
> That leaves the question if I could expect to find the implicit page,
> request and session objects stored in the pagecontext name table (c/w javadoc
> for PageContext) ?
>
At least under Tomcat, these objects are available as page scope attributes,
under the symbolic names like PageContext.SESSION and so on. I believe this is
required, but haven't had a chance to double check.
>
> Matthias (mailto:make@BESToffers.de)
Craig
Re[4]: [Q] How to query session.isNew() with struts:logic tags
Posted by Matthias Kerkhoff <ma...@BESToffers.de>.
Hi Joe,
> mayby i am wrong but
> PageContext.SESSION is a string, so how could it expose a property "new" ?
It's a string. That's correct. However, I have used it as RTE to specify
the _name_ of a bean that has a property "new" (at least, that was my
intention). It's no longer important for me, I'm using java code now.
That leaves the question if I could expect to find the implicit page,
request and session objects stored in the pagecontext name table (c/w javadoc
for PageContext) ?
Matthias (mailto:make@BESToffers.de)
Re: [Q] How to query session.isNew() with struts:logic tags
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Joe Peer wrote:
> mayby i am wrong but
> PageContext.SESSION is a string, so how could it expose a property "new" ?
> why do'nt you just use the implcit _session_-object?
> -joe
>
Yes, PageContext.SESSION is a string. The <logic:equal> tag interprets the
"name" attribute, where Matthias was trying to use it, as the name of the bean
from which to extract a property. Therefore, Struts is really looking at the
"new" property of the session instance for the current session -- because that
is the page scope bean that the JSP implementation exposes under that String
name.
Craig McClanahan
>
> ----- Original Message -----
> From: Matthias Kerkhoff <ma...@BESToffers.de>
> To: Craig R. McClanahan <st...@jakarta.apache.org>
> Sent: Monday, November 20, 2000 3:26 AM
> Subject: Re[2]: [Q] How to query session.isNew() with struts:logic tags
>
> > >> I need a hint, how I could query properties of implicit JSP variables
> > >> like session, request or page. I tried the following, but it didn't
> work:
> > >>
> > >> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="if" %>
> > >> <if:equal name="<%= PageContext.SESSION %>" property="new"
> value="true">Session is new</if:equal>
> > >>
> > >> Is this my fault, or have I (once again) found a container bug ?
> > >>
> >
> > > It would be helpful to know what kind of compile or runtime error you
> are getting.
> >
> > Ah, sorry. It's a runtime error saying that javax.servlet....
> > (ie. PageContext.SESSION) doesn't exist as bean.
> >
> > --
> > Matthias (mailto:make@BESToffers.de)
> >
> >
Re: Re[2]: [Q] How to query session.isNew() with struts:logic tags
Posted by Joe Peer <jo...@wap-force.net>.
mayby i am wrong but
PageContext.SESSION is a string, so how could it expose a property "new" ?
why do'nt you just use the implcit _session_-object?
-joe
----- Original Message -----
From: Matthias Kerkhoff <ma...@BESToffers.de>
To: Craig R. McClanahan <st...@jakarta.apache.org>
Sent: Monday, November 20, 2000 3:26 AM
Subject: Re[2]: [Q] How to query session.isNew() with struts:logic tags
> >> I need a hint, how I could query properties of implicit JSP variables
> >> like session, request or page. I tried the following, but it didn't
work:
> >>
> >> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="if" %>
> >> <if:equal name="<%= PageContext.SESSION %>" property="new"
value="true">Session is new</if:equal>
> >>
> >> Is this my fault, or have I (once again) found a container bug ?
> >>
>
> > It would be helpful to know what kind of compile or runtime error you
are getting.
>
> Ah, sorry. It's a runtime error saying that javax.servlet....
> (ie. PageContext.SESSION) doesn't exist as bean.
>
> --
> Matthias (mailto:make@BESToffers.de)
>
>
Re[2]: [Q] How to query session.isNew() with struts:logic tags
Posted by Matthias Kerkhoff <ma...@BESToffers.de>.
>> I need a hint, how I could query properties of implicit JSP variables
>> like session, request or page. I tried the following, but it didn't work:
>>
>> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="if" %>
>> <if:equal name="<%= PageContext.SESSION %>" property="new" value="true">Session is new</if:equal>
>>
>> Is this my fault, or have I (once again) found a container bug ?
>>
> It would be helpful to know what kind of compile or runtime error you are getting.
Ah, sorry. It's a runtime error saying that javax.servlet....
(ie. PageContext.SESSION) doesn't exist as bean.
--
Matthias (mailto:make@BESToffers.de)
Re: [Q] How to query session.isNew() with struts:logic tags
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Matthias Kerkhoff wrote:
> Hi all,
>
> I need a hint, how I could query properties of implicit JSP variables
> like session, request or page. I tried the following, but it didn't work:
>
> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="if" %>
> <if:equal name="<%= PageContext.SESSION %>" property="new" value="true">Session is new</if:equal>
>
> Is this my fault, or have I (once again) found a container bug ?
>
It would be helpful to know what kind of compile or runtime error you are getting.
>
> Thanks for your help.
>
> --
> Matthias mailto:make@BESToffers.de
Craig