Meaningless Drivel is fun!*
The moose likes JSP and the fly likes scope of bean in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "scope of bean in jsp" Watch "scope of bean in jsp" New topic
Author

scope of bean in jsp

punna Kumar
Ranch Hand

Joined: Feb 28, 2005
Posts: 80
1)in jsp the java bean can not used in below scope

a)application
b)session
c)request
d)page

what is the answer for the above question
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Which do you think it is and why?

We, here at Javaranch, enjoy helping people learn about Java but are loath to answer homework or test questions for you.
Please see:
http://faq.javaranch.com/view?DoYourOwnHomework

Let us know your answer and we'll be happy to comment on it but, please, don't ever post multiple choice questions to these forums.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
punna Kumar
Ranch Hand

Joined: Feb 28, 2005
Posts: 80
Sorry Ben,

It's not a homework.......

one of my team member ask this question in chit chating in java.......

My answer is a i mean Application

java bean does not support the application level scope in jsp.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61451
    
  67

Originally posted by punna Kumar:
java bean does not support the application level scope in jsp.


Really? What makes you think so?
[ July 31, 2006: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
Actually my answer would be
e)none of the above.

Take a look at the valid values for scope when declaring a java bean on a page: http://java.sun.com/products/jsp/syntax/1.2/syntaxref1217.html#8865
punna Kumar
Ranch Hand

Joined: Feb 28, 2005
Posts: 80
thanks for the replay.

but there is no option like none of the above..............

<jsp:useBean> have a attribute called "scope".

i fell question is related to the what is the scope of useBean in jsp page.....

any idea.........
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61451
    
  67

Originally posted by punna Kumar:

any idea


1) Move your mouse over the link in Stefan's post.
2) When the cursor changes to the little hand, click the mouse.
3) Read.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

The spec is pretty clear about what a bean's scope is.

Scope:
The scope within which the reference is available. The default value is page. See the description of the scope attribute defined earlier herein. A translation error must occur if scope is not one of "page", "request", "session" or "application".


[My Blog]
All roads lead to JavaRanch
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: scope of bean in jsp