About Question enthuware.jwpv6.2.621 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
ETS User

About Question enthuware.jwpv6.2.621 :

Post by ETS User »

${not(sessionScope.length)} returns true because

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

and
${not ""} returns true

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.621 :

Post 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!

viva

Re: About Question enthuware.jwpv6.2.621 :

Post 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...

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.621 :

Post 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.

sebastien

Re: About Question enthuware.jwpv6.2.621 :

Post 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

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.621 :

Post 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!

sebastien

Re: About Question enthuware.jwpv6.2.621 :

Post 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

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests