Page 1 of 1

About Question enthuware.jwpv6.2.972 :

Posted: Sun Oct 16, 2011 9:38 am
by ETS User
I think that option 3 is also correct:
ServletRequest and PageContext respectively.
As the explanation of option 4 says:
As per Section JSP.1.8.3 - Implicit Objects - The object implementing the request scope is request protocol dependent subtype of javax.servlet.ServletRequest e.g. javax.servlet.http.HttpServletRequest.
so if the request is not a HTTP request then request attributes will be stored in ServletRequest implementation class.

Re: About Question enthuware.jwpv6.2.972 :

Posted: Sun Oct 16, 2011 10:04 am
by admin
Right, a sub type of ServletRequest but not in ServletRequest.

Re: About Question enthuware.jwpv6.2.972 :

Posted: Fri Nov 16, 2012 5:21 pm
by Guest
Sorry but you write "classes of objects". But ServletRequest and HttpServletRequest are intefaces.

Re: About Question enthuware.jwpv6.2.972 :

Posted: Sun Nov 18, 2012 8:02 am
by admin
Guest wrote:Sorry but you write "classes of objects". But ServletRequest and HttpServletRequest are intefaces.
Actually, the term class does not always refer to a class construct. It is used generically for both the constructs i.e. class and interface. For example, when you compile a java file containing an interface, you still get a class file. Not an interface file. The word classes is used in the same sense here.

HTH,
Paul.

Re: About Question enthuware.jwpv6.2.972 :

Posted: Mon Sep 02, 2013 12:41 pm
by basamajoe
In the explanation is said that:
There are 4 jsp scopes: application, session, request and page

application scoped beans are stored in ServletContext.

session scoped beans are stored in HttpSession.

request scoped beans are stored in ServletRequest.

page scoped beans are stored in PageContext.
but you explain that attributes in request scope are saved in a subtype of ServletRequest, so is it the explanation wrong?

Re: About Question enthuware.jwpv6.2.972 :

Posted: Tue Sep 03, 2013 11:30 am
by admin
ServletRequest is an interface, so at runtime there will be a class that implements this interface. But from an API perspective, it is ServletRequest interface that you will be using to manage request attributes. So, both are correct.

HTH,
Paul.

Re: About Question enthuware.jwpv6.2.972 :

Posted: Fri Jun 12, 2015 1:27 pm
by pwang8
I think basamajoe has a point. Option 3 is more correct than option 4. Theoretically JSP can use non HTTP protocols. Attributes are definitely generic, ie not HTTP dependent, not like cookies and headers.