This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Doubt in UrlRewriting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Doubt in UrlRewriting" Watch "Doubt in UrlRewriting" New topic
Author

Doubt in UrlRewriting

Ankur Gargg
Ranch Hand

Joined: Sep 11, 2011
Posts: 55

HI Ranchers

I have got two doubts
1)session.setAttribute("a",5);

Will this work in JEE 6?I mean to ask whether autoboxing feature is available in JEE6 .I know it is available in JDK 1.6.

2)Upon a user's first visit to website which two operations are always performed when the getSession() is called without arguments on a servlet
a)All URLS' returned are encoded.
b)An HttpSession object is created if necessary.
c)Session ID is stored as cookie in response.

As per me answer should be a) and c).Am I correct ranchers?



Piyush Joshi
Ranch Hand

Joined: Jun 10, 2011
Posts: 207

1) of course it will work. Java EE 6 is built on top of Java SE 6.
2) wrong.
Option "a" is wrong because url rewriting does not happen automatically.
Option "b" is correct because this is what getSession() does.
Option "c" is correct because container is required to support cookies as session tracking mechanism.

Piyush
Ankur Gargg
Ranch Hand

Joined: Sep 11, 2011
Posts: 55

Hi Piyush

What if I was writing the SCWCD 5 exam then what would have been your answer for 1).
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1624
    
  23

Hi Ankurr,

What if I was writing the SCWCD 5 exam then what would have been your answer for 1).

This depends on your servlet-container provider. If you check the servlet specifications (e.g. Servlet 2.4, SRV 1.2):
J2SE 1.3 is the minimum version of the underlying Java platform with which
servlet containers must be built.

Have you tried Tomcat 5.5? I guess it does support Java SE 1.5 and therfore autoboxing.

Regards,
Frits
Ankur Gargg
Ranch Hand

Joined: Sep 11, 2011
Posts: 55

Hi

In exam we are not given the container provider details.
So suppose I am writing SCWCD 5 then can I consider autoboxing as automatic?
I mean will autoboxing occur.


Regards
Ankur Garg
Piyush Joshi
Ranch Hand

Joined: Jun 10, 2011
Posts: 207

JRE version of JVM, that container uses to run, can be changed as needed (Just set the JAVA_HOME environment variable).
In exam you can assume that Java EE5 container runs Java SE5 JVM, so the autoboxing will work.
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1624
    
  23

So suppose I am writing SCWCD 5 then can I consider autoboxing as automatic?

I agree with Piyush (if I had to choose an option in such a question).
An exam question involving autoboxing without mentioning Java SE1.5 wouldn't be fair as it isn't mandated by the specifications (and those are the subject of the certification), so I guess it won't happen.

Regards,
Frits
 
jQuery in Action, 2nd edition
 
subject: Doubt in UrlRewriting
 
Similar Threads
j2ee RI where to download from?
Displaying hierarchy diagram
ejb exam question
But , Where is Uncle Bob
Objects eligible for GC