Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question ID :999996968700 JWeb+

 
Manoj Pooleery
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have declared a useBean tag as:
<jsp:useBean id="man" class="animal.Human" scope="application"/>
In which type of object will this bean be kept?
Answers :
Servlet
HttpSession
ServletContext
ServletConfig
ApplicationContext
Can anybody help me with the answer?
Thanks
-Manoj.
 
Enrico Mannarino
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I would say: ServletContext.
The scope "application" corresponds to ServletContext which keeps the information for the application
But I've been worng before!
/Enrico
 
Manoj Pooleery
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I missed the 'scope' part of the declaration.
-Manoj.
 
Kevin Mukhar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Enrico Mannarino:
I would say: ServletContext.
The scope "application" corresponds to ServletContext which keeps the information for the application
But I've been worng before!
/Enrico

I try not to respond to answers that are correct, (and your answer is correct). I would just like to point out that many questions of this type can be answered by checking the specification. Here is the relevant text from JSP 2.0:
JSP.5.1 <jsp:useBean>
A jsp:useBean action associates an instance of a Java programming language object defined within a given scope and available with a given id with a newly declared scripting variable of the same id.
.....
The scope Attribute
The scope=�page|request|session|application� attribute/value tuple is associated with, and modifies the behavior of the id attribute described above (it has both translation time and client request processing time semantics). In particular it describes the namespace, the implicit lifecycle of the object reference associated with the name, and the APIs used to access this association, as follows:
.....
application - The named object is available from the current page�s ServletContext object using the getAttribute(name) method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic