• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

a JSTL question in Whizlabs Exam Simulator

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Here is my question found in Whizlabs Exam Simulator:

Which of the following JSTL fragment will not delete the "empName" attribute from "session" scope? Select one choice.
a. <c:remove name="empName"/>
b. <c:set var="empName" scope="session" value=""/>
c. <c:remove scope="session" name="empName"/>
d. both a and b
e. None of the above

I think the answer is a and c. Because <c:set> syntax is
<c:remove var="varName" [scope="{page|request|session|application}]/>
not <c:remove name="..." ..../>


But when I checked answer, it shows e. Can anybody help me figure it out? Thanks.
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The question reads which one will NOT remove enpName from the session scope. A, B, and C will all remove empName.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi patrick

yeah : i misread the q (didnt see the "not"). but surely

a. <c:remove name="empName"/>

default is page not session scope and "name" should be "var". so a wont remove.


b. <c:set var="empName" scope="session" value=""/>

setting to "" doesnt remove the attribute, does it?


c. <c:remove scope="session" name="empName"/>

invalid : should be var="empName"?

d. both a and b

neither will do it so both wont

e. None of the above

meaning "none of the above will not remove" so that's "all of the above will remove"? odd. but i can't agree with e. either.


my JSTL newbie mind needs enlightenment,


peter
 
Patrick Williams
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I didn't catch the the var/name error. I agree! Good Catch! If it were var instead of name, they would all remove the empName attribute. A null value on c:set will remove the empName attribute. That information can be found on pg 25 of the JSTL spec (sec 4.3).
 
Ping Li
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you all for replying my question. I passed SCWCD this past Saturday at 84%. From my experience HFSJ is enough for passing the exam. I also did some mock exams from whizlabs simulator (My scores on whizlabs are very close the the real exam).

Thanks,
 
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"java_masker"

I don't know why nobody mentioned this before, but your display name does not meet our naming policy. Please read it, follow the link at the bottom, and change your name to something appropriate.

Thanks!
 
F is for finger. Can you stick your finger in your nose? Doesn't that feel nice? Now try this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic