Posted on 2003-10-30
we have <%@useBean id = "myBean" class = "com.junk.MyBeanClass" scope = "page">
in a jsp called "MyFirstJSP.jsp"
This is equilaent to
MyClassBean myBean = new MyClassBean();
My question is in the scope attribute.
page "the bean is there as long as the page is active"
---> Does this mean the scope of the object is throughout the page and when the user moves from the page the object is not avaioable
request "the bean is avaialbale for the target of the page ..."
--->is the scope avaibale for the request , which means if the page is forward to nect page , i need not create a new object but use the existing object
session "the bean is accesibke from any jsp page participate in the session"
---> I can use the objecy anywhere i want in all the pages for that particular session. ie I can load user info such as name , login , passowrd in a bean and call it anywhere without making a new object in each page.
ie in MySecondJSP.jsp I can use "myBean.getInfo() " without ceating the obejct in the second page
appication "the bean ia avaibale throuhg the appication"
---> I can call the object of the bean anywhere i want an example is to store some name values pais similar to servelt context.
Thx for ur help :)