What is jsp:usebean. What are the scope attributes & difference between these attributes

Showing Answers 1 - 5 of 5 Answers

sr

  • Jun 9th, 2005
 

page, request, session, application

  Was this answer useful?  Yes

prabesh

  • Jul 24th, 2005
 

This tag is used to declare and instantiate the JavaBean class.

  Was this answer useful?  Yes

J. P. Naidu

  • Jul 27th, 2005
 

There are 4 scopes application, session, request and page in the order of thier significance. 
 
Application represent the ServletContext. The scope is accesible throught out the application. 
 
session represents HTTPSession object. This is valid till the user requests the application. 
 
Request represent the HTTPServletRequest and valdi to a particular request. A request may span a single JSP page or multiple depending upon teh situations. 
 
Page is the least valid scope. It is valid to the particular JSP page only This is some thing like private variable 
 

  Was this answer useful?  Yes

Jayakar

  • Oct 14th, 2005
 

jsp:useBean is used for instantited the Bean class. The scope attribute is used to decide the life of the bean and visibility of the bean.

The scope attributes are session, application,page,request

scope: the bean is available for current page and all other jsp's which are participated in the session.

application : The bean will be stored inside the servlet context.we want store the information that is not related to a particular client.the we go for application.

page: The bean will be stored and bean will be created for every time the page is accessed. The default scope is pagae.

  Was this answer useful?  Yes

satyagodey

  • Oct 14th, 2005
 

Using a Bean in a JSP PageTo use a bean in a JSP page, three attributes must be supplied - an id, which provides a local name for the bean, the bean's class name, which is used to instantiate the bean if it does not exit, and a scope, which specifies the lifetime of the bean.There are four scopes available - page, request, session, and application. These scopes are any way described above.....A page-scoped bean is available only within the JSP page and is destroyed when the page has finished generating its output for the request. A request-scoped bean is destroyed when the response is sent. A session-scoped bean is destroyed when the session is destroyed. An application-scoped bean is destroyed when the web application is destroyed.This example retrieves a session-scoped bean and makes it available using the id myBean. The bean is automatically created if it does not exist: If it is necessary to initialize the bean after it is created, the initialization code can be placed in the body of the jsp:useBean action. The body will not be executed if the bean already exists.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions