aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes A Speculation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "A Speculation" Watch "A Speculation" New topic
Author

A Speculation

Poonam Agarwal
Ranch Hand

Joined: May 12, 2008
Posts: 323
You have declared a useBean tag as: (question from Enthuware)

<jsp:useBean id="man" class="animal.Human"/>

In which class of object will this bean be kept?

1. Servlet
2. HttpSession
3. ServletContext
4. ServletConfig
5. PageContext

Given option is 5. I really don't understand what to say about these type of question, which totaly make you confused
I am really getting pissed with such questions. Completely worthless.

First of all in all the above mention option, no one is the correct one. Because when <jsp:useBean> tag dosen't mention scope attribute, its default scope to page.
page is an object of type Object.

there are only four scop avaiable to the JSP page, session, context, request, AND page scope.
The explanation given by the Enthuware is:

When scope is not given explicitly, 'page' is assumed.

page : PageContext

request : ServletRequest

session : HttpSession

application : ServletContext

what to say about these types of question???

Thanks


Thanks <br />Poonam Agarwal SCWCD 86%
Milton Ochoa
Ranch Hand

Joined: Oct 23, 2007
Posts: 336

without comments

Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

You'll find an interesting information at "JSP.1.8.2 Objects and Scopes" in the JSP spec.
page - Objects with page scope are accessible only within the page where they
are created. All references to such an object shall be released after the response
is sent back to the client from the JSP page or the request is forwarded somewhere
else
. References to objects with page scope are stored in the pageContext
object
.

In the exam, I think you'll have more explicit answers than that.


[My Blog]
All roads lead to JavaRanch
Poonam Agarwal
Ranch Hand

Joined: May 12, 2008
Posts: 323
sorry Milton, not getting you
Poonam Agarwal
Ranch Hand

Joined: May 12, 2008
Posts: 323
So should I ignore it. OR page object is type of pageContext ??

Christophe, I am very much confused.
I have seen couple of mock questions who says that page is an object of pageContext, but HFSJ specify the page is a type of Oject

please help me out
Poonam Agarwal
Ranch Hand

Joined: May 12, 2008
Posts: 323
I find another one

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

1. HttpServletRequest and ServletContext respectively.
2. ServletRequest and ServletConfig respectively.
3. ServletRequest and PageContext respectively.
4. HttpServletRequest and PageContext respectively.
5. ServletConfig for both.

the 4th is correct one according to Enthuware. I am really getting pissed.

Is anybody has to say about this???
Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3201
    
    2
Hi Poonam,
I am not sure what is the confusion with these two questions. Every object in java extends from Object, so saying that page is of class Object doesn't actually give you any new information. So HFSJ is not incorrect in this respect but is not useful either.

The objective of the two questions is to test whether you know the class of the container object for various scopes. The first questions tests another important aspect that when scope attribute is not specified, "page" scope is assumed. Both are quite straightforward.

If you could please point out the cause of confusion, we will definitely try to improve it.

HTH,
Paul.


Enthuware - Best Mock Exams and Questions for Oracle/Sun Java Certifications
Quality Guaranteed - Pass or Full Refund!
Poonam Agarwal
Ranch Hand

Joined: May 12, 2008
Posts: 323
hello paul,

My confusion is if page is a type of pageContext oject , As it is given in my previous post (by enthuware explanation),
1. If we says default to page scope, it mean this OR objects are bound to this scope are available only for this page. Am i right??
It dosen't mean that attribute or bean bound with this scope exists in the pageContext(application acope) ??

My confusion is getting very ugly , I don't konw how to clear it up..
Please help me sort ir out..
Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3201
    
    2
Poonam Agarwal wrote:hello paul,

My confusion is if page is a type of pageContext oject , As it is given in my previous post (by enthuware explanation),
1. If we says default to page scope, it mean this OR objects are bound to this scope are available only for this page. Am i right??
It dosen't mean that attribute or bean bound with this scope exists in the pageContext(application acope) ??

My confusion is getting very ugly , I don't konw how to clear it up..
Please help me sort ir out..


This might help -
1. page, request , session, and application are names, just simple names used for human convenience, of the various "scopes" in which you can keep objects.

2. So, when you say that an object O1 is kept in scope S, O1 is actually stored in a container (like you store key value pairs in a HashMap). For each scope there is a different container. For page scope the class of the container object is PageContext. For request scope the class of the container object is ServletRequest and so on.

3. When you store an object in a container, you can get that object back only from locations where that same container is available. For example, the container for page scope is available only in that page.

4. PageContext is not same as "application". "application" scoped objects are stored in ServletContext and so they are available from everywhere in the webapp (because there is only one ServletContext in a webapp and it is accessible everywhere)

HTH,
Paul.

On a side note, my humble suggestion is that before attempting any mock questions, you need to thoroughly read a book and develop some sample web applications. From the questions that you have posted on this forum, I believe going through the book will help you immensly. Otherwise, you may not be able to derive full value out of mock exams.

Poonam Agarwal
Ranch Hand

Joined: May 12, 2008
Posts: 323
paul,

For page scope the class of the container object is PageContext


you want to say that HFSJ is giving a wrong information about this doubt.
it clearly says that page is a type of Object. And pageContext is type of pageContext itself. If page is type of pageContext and what is type of pageContext implicit variable???

I don't think if both of these refer to the same class OR type, what is the need to have 2 implicit object refering to the same object??
we could have use page implicit object itself, in the place where pageContext is required.



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A Speculation
 
Similar Threads
explanation in Jwebplus
page scope
doubt in a question in marcus summary quiz 1
Bean standard action doubt
Please answer me this question.