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 For JSP scopes of request and page, what type of object is used to store the attribut 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 "For JSP scopes of request and page, what type of object is used to store the attribut" Watch "For JSP scopes of request and page, what type of object is used to store the attribut" New topic
Author

For JSP scopes of request and page, what type of object is used to store the attribut

Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
a. ServletRequest and PageContext respectively.

b. HttpServletRequest and PageContext respectively

c. HttpServletRequest and ServletContext respectively.

d. ServletConfig for both.

Please select 1 answer.
I am very confused about the answer here.

This question is from Ethuware.


SCJP 1.4, SCWCD 5, SCBCD 5, OCPJWSD 5,SCEA-1, Started Assignment Part 2
My blog- http://rkydesigns.blogspot.com
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

This question is about the type of objects used to store request-scope attributes and page-scope attributes. Attributes stored in the request scope use the "request" implicit object, which is javax.servlet.ServletRequest type. Attributes stored in the page scope use the "pageContext" implicit object, which is javax.servlet.jsp.PageContext type.
[ August 02, 2008: Message edited by: Christophe Verre ]

[My Blog]
All roads lead to JavaRanch
Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
I also thought that the answer should be ServletRequest and PageContext respectively.


But the actual answer given is HttpServletRequest and PageContext respectively.

So here the difference comes for the ServletRequest ...
Sunny Jain
Ranch Hand

Joined: Jul 23, 2007
Posts: 433

Hi, I think enthuware is correct. Even the HFSJ says there are 9 implicit objects are in JSP:

request --> HttpServletRequest
response --> HttpServletResponse
out --> JspWriter
page --> Object
pageContext --> PageContext
exception --> Throwable
session --> HttpSession
application --> ServletContext
config --> ServletConfig

so Answer should be HttpServletRequest and PageContext


Thanks and Regards,
SCJP 1.5 (90%), SCWCD 1.5 (85%), The Jovial Java, java.util.concurrent tutorial
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

The spec says that the "request" implicit object is protocol dependent subtype of: javax.servlet.ServletRequest. For example javax.servlet.http.HttpServletRequest. So I still think the correct answer is "a".
Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
But the correct answer given is c.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

It cannot be c. ServletContext is used for the application scope, not page scope.

But the actual answer given is HttpServletRequest and PageContext respectively.

But the correct answer given is c.

That's two different answers
Baddy Davay
Greenhorn

Joined: Aug 10, 2008
Posts: 26
you said that it should be protocol dependent that means only HTTP based,so HttpServletRequest type of object is used.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

that means only HTTP based

Why ? I don't see anything about using HTTP in the question. Protocol dependent means any protocol. So I would still choose ServletRequest
Sandeep Bhandari
Ranch Hand

Joined: Apr 16, 2004
Posts: 201
Originally posted by Christophe Verre:

Why ? I don't see anything about using HTTP in the question. Protocol dependent means any protocol. So I would still choose ServletRequest


But the exam is SCWCD where W stands for web. How can they test on some other protocol.


SCJP 96% | SCWCD 90%| SCJP mock exams | My SCJP blog
Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
Even Enthuware also make final answers from the specifications. And Verre also made from Specifications, but still there answers are different.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: For JSP scopes of request and page, what type of object is used to store the attribut
 
Similar Threads
types of implicit variabless
DOUBT on a question JSP SCOPES
JSP implicit Object HttpServletRequest or ServletRequest ?
implicit objects in jsp
Q: Data type for JSP implicit objects