This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

doubt on mock exam question

 
rachna jain
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
${not map.c}


there is a map
having

map.put("c" "42");


this evaluates to true.

I dont understand how?


Also


 
Himanshu Kansal
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Could you please tell where is this map, scope etc.

Regards
 
rachna jain
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ohh sorry its set in request scope


<%java.util.Map map = new java.util Hashmap;
request.setAttribute("map" map);

map.put("c" "42");%>
 
rachna jain
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

Please see page 728 HFS for filter qno-1

can anyone explain what is callback and inline method for filter.


 
Himanshu Kansal
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try qualifying "map" for requestScope in that case like "requestScope.map"

Regards
 
rachna jain
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry i am unable to get you can you please clarify further
 
Alex Pustovit
Greenhorn
Posts: 10
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

the original question was quite interesting.
My explanations is: your put string 42 to the map. This value later is coerced to boolean using java.lang.Boolean.valueOf(STRING) function (see JSP 2.0 specification, page 116). Because mentioned function returns true only if STRING value is "true", you get the "false" value for expression map.c and finally true (${not map.c}) on your page.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!