Dear all, I am confuse about useBean with scope page or default. My understanding is if I have usebean, example <jsp:useBean id="myid" class="myclass"/> That statement make "myid" have scope page. I think that jsp container will create new instance in pageContext for that JSP page. And every request into that page will use the same that instance. Is it true? Correct me if I am wrong... regards daniel
posted 13 years ago
Correct me if I'm wrong but I believe the answer to your question is this: If a bean with the name of myid is not created, then one will be instantiated (providing you have a default constructor for your bean class). After one is located or instantiated it will be put into pageContext (the default). I believe if you make another request to this page the bean will not be available and an new instance will be created. I believe pageContext refers to specifically that page. If you make another request then you go off of that page. If you want your bean to be available for multiple request then set the scope of the bean to either session or application. If set to application then it is available to not only that specific user session but exposed to the entire web application. Hope I'm right and this helps, Cheers Ryan
SCJP 1.4, SCWCD
Java: The power, elegance, and simplicity of a hand grenade
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads