• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Amandeep Singh
Ranch Hand
Posts: 850
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Amandeep Singh
Ranch Hand
Posts: 850
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ...
 
Deepak Chopra
Ranch Hand
Posts: 433
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 850
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But the correct answer given is c.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you said that it should be protocol dependent that means only HTTP based,so HttpServletRequest type of object is used.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Amandeep Singh
Ranch Hand
Posts: 850
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even Enthuware also make final answers from the specifications. And Verre also made from Specifications, but still there answers are different.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic