• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

From JWebPlus reg jsp scopes

 
MR Rath
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question ID :997967667647
For the JSP scopes of request and page, what type of object is used to store the attributes?
a. HttpServletRequest & ServletContext resp
b. ServletRequest & ServletConfig resp
c. ServleRequest & PageContext resp
d. HttpServletRequest & PageContext resp
e. ServletConfig for both
Ans given is c.
But shouldn't be d, since the request scope vars are stored in HttpServletRequest ( Ref Table 12.1 Page 210 of SCWCD study kit)
Thanks
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree -- even the JSP 1.2 Spec says:
JSP 2.8.3 Implicit Objects:
Name: request
Type: protocol dependent subtype of javax.servlet.ServletRequest (e.g. javax.servlet.http.HttpServletRequest)
Semantics & Scope: The request triggering the service invocation. Request scope.
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 3817
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, as the JSP spec says, it is a "protocol dependent subtype of javax.servlet.ServletRequest ". So it is not necessarily HttpServletRequest. So the given answer is correct, I think.
But I also think the presence of an option with HttpServletRequest is making it needlessly confusing.
 
S. Ganapathy
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One should take most super type object. So it is ServletRequest, not HttpServletRequest. And morevoer HttpServletRequest is protocol dependent. Generic objects are protocol independent. Implicit objeft specific to http is session (HttpSession).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic