About Question enthuware.jwpv6.2.972 :

Moderator: admin

Post Reply
ETS User

About Question enthuware.jwpv6.2.972 :

Post 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.

Online
admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.972 :

Post by admin »

Right, a sub type of ServletRequest but not in ServletRequest.
If you like our products and services, please help us by posting your review here.

Guest

Re: About Question enthuware.jwpv6.2.972 :

Post by Guest »

Sorry but you write "classes of objects". But ServletRequest and HttpServletRequest are intefaces.

Online
admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.972 :

Post 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.
If you like our products and services, please help us by posting your review here.

basamajoe
Posts: 21
Joined: Fri Apr 26, 2013 3:40 am
Contact:

Re: About Question enthuware.jwpv6.2.972 :

Post 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?

Online
admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.972 :

Post 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.
If you like our products and services, please help us by posting your review here.

pwang8
Posts: 8
Joined: Thu Apr 09, 2015 12:32 pm
Contact:

Re: About Question enthuware.jwpv6.2.972 :

Post 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.

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests