• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 856
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 856
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ...
 
Ranch Hand
Posts: 433
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 856
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But the correct answer given is c.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 856
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic