Page 1 of 1

About Question enthuware.jwpv6.2.621 :

Posted: Wed Jul 04, 2012 9:04 am
by ETS User
${not(sessionScope.length)} returns true because

${sessionScope.length} returns "" empty string not 0

and
${not ""} returns true

Re: About Question enthuware.jwpv6.2.621 :

Posted: Wed Jul 04, 2012 10:30 am
by admin
Actually, sessionScope.length should return null ( ${sessionScope.length == null} prints true. ) but ${sessionScope.length} is printed as "".

I think some version of GF (on which this question was tested) probably printed 0 and that is why the explanation says 0. This is now fixed.

thank you for your feedback!

Re: About Question enthuware.jwpv6.2.621 :

Posted: Fri Sep 07, 2012 6:24 am
by viva
On tomcat 7.0 when used directive <%@page session="false"%> this answer " ${not(pageContext.session)}" actually returns true...
If the directive is not used then it does not compile.

The question says that "if no session has been established at the time of executing the expression" so i wonder if this answer should be considered wrong...

Re: About Question enthuware.jwpv6.2.621 :

Posted: Sun Sep 16, 2012 6:36 am
by admin
viva wrote:On tomcat 7.0 when used directive <%@page session="false"%> this answer " ${not(pageContext.session)}" actually returns true...
If the directive is not used then it does not compile.

The question says that "if no session has been established at the time of executing the expression" so i wonder if this answer should be considered wrong...
This seems to be an issue with tomcat implementation. I don't see why it should generate a compilation error.

Re: About Question enthuware.jwpv6.2.621 :

Posted: Thu Jan 24, 2013 3:30 pm
by sebastien
Hello,

I read charles lyons's book and I thought that with directive <%@page session="false"%>, every attempt to access session should issue an error.

So I understand why it should issue a compilation error when try ${not(pageContext.session)}

But for the same explanation ${not(requestScope.session)} should issue a compilation error (or maybe a translation error ?)

thx

Seb

Re: About Question enthuware.jwpv6.2.621 :

Posted: Fri Jan 25, 2013 4:16 pm
by admin
Seb,
What you say is true if the page does not participate in the session i.e. when <@page session="false" %> is used. However, in this question, it says, "the session has not been established yet". That doesn't mean the page does not participate in a session at all.

But you are right. The question is not clear enough. It has now been updated.

thank you for your feedback!

Re: About Question enthuware.jwpv6.2.621 :

Posted: Sun Jan 27, 2013 11:20 am
by sebastien
thanks for your quick answer,

Indeed I had not well understood the difference between <@page session="false" %> and "the session has not been established yet"

Seb