• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Do I have the Prerequisite for taking OCPJWCD?

 
H Yin
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.
 
A.J. Côté
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
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic