File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Bean instantiation from JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Bean instantiation from JSP" Watch "Bean instantiation from JSP" New topic

Bean instantiation from JSP

Ian Whitelaw

Joined: Mar 30, 2000
Posts: 13
I have a JSP, shown below, which uses a JavaBean to write to an Access database. My understanding of the jsp:useBean tag is that it is will locate and use a bean if one exists, otherwise it instantiates a new one. Is this right?
If it is, why do I get a new instance of my bean whenever I submit the page, even when I specify the bean's scope as "session"? I don't appear to be getting a new session (Session ID remains the same) but the InstanceID (determined in the bean's constructor) changes every time.
I agree. Here's the link:
subject: Bean instantiation from JSP
jQuery in Action, 3rd edition