About Question enthuware.jwpv6.2.621 :
Moderators: Site Manager, fjwalraven
About Question enthuware.jwpv6.2.621 :
${not(sessionScope.length)} returns true because
${sessionScope.length} returns "" empty string not 0
and
${not ""} returns true
${sessionScope.length} returns "" empty string not 0
and
${not ""} returns true
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.621 :
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!
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 :
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...
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...
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.621 :
This seems to be an issue with tomcat implementation. I don't see why it should generate a compilation error.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...
Re: About Question enthuware.jwpv6.2.621 :
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
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
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.621 :
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!
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 :
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
Indeed I had not well understood the difference between <@page session="false" %> and "the session has not been established yet"
Seb
Who is online
Users browsing this forum: No registered users and 1 guest