Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Do I have the Prerequisite for taking OCPJWCD?  RSS feed

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to take the Oracle Certified JSP/Servlets test, but I wonder if I have to take the Programmer test first. I have the Sun Certified Programmer for the Java 2 Platform in 2001. I noticed that Oracle says "SCJP Professional any version" as requirement. I am baffled by the word 'Professional".
Also I am reading the HF JSP and Servlets now. I have a question about EL with Cookie implicit object. Wouldn't ${cookie.userName} print the value of the cookie named username, since cookie is a Map object anyway. Why do we need the cumbersome syntax ${ cookie.userName.value}?
Thanks.
 
Ranch Hand
Posts: 417
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

First, I would never put the username in a cookie. Cookies should only contain one unique but meaningless value example: 4832e2e2483ad561481693194232afa195607787


have a question about EL with Cookie implicit object. Wouldn't ${cookie.userName} print the value of the cookie named username, since cookie is a Map object anyway. Why do we need the cumbersome syntax ${ cookie.userName.value}?



A map has key,values pairs. So it seems logical to specifically retrieve the value.
 
H Yin
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

A.J. Côté wrote:
A map has key,values pairs. So it seems logical to specifically retrieve the value.


But logically, if you provide a key to a map, would it automatically return the value? Do you need specifically say "value"?
What else would you expect to return? like ${cookie.userName.key}?
Thanks
 
A.J. Côté
Ranch Hand
Posts: 417
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't tested it but ${cookie.userName} might return the Entry which contains both the key and the value. This is just a guess...

https://docs.oracle.com/javase/7/docs/api/java/util/Map.Entry.html
 
Creator of Enthuware JWS+ V6
Posts: 3241
283
Android Chrome Eclipse IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that for any Map you can get the value in three ways:


EL has a number of implicit objects of which "cookie" has a description of "A map of HttpServletRequest cookie names and cookie objects". In other words ${cookie.userName} will return the Cookie with name "userName" and note that userName is the key in the map. The value is the Cookie object itself, and from the Cookie class you can see that you can get the "value" by calling getValue.


 
H Yin
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I understand now.
 
I will open the floodgates of his own worst nightmare! All in a tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!