This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm a newbie and I have a question about Tomcat and instances.
I read some time ago that when a user do a request, the container give an instance of the web aplication to the user, translate jsp code to servlet code, and show to the user the html, then each user of the aplication will have an instance of each class (that the jsp code needs) in every request.
My question is there is a way to have a single instance (for example Users.class) shared by application users? Then if a user change something of that class, all users see that change.
Thanks in advance.
[ June 17, 2006: Message edited by: Jordi Monn� ] [ June 17, 2006: Message edited by: Jordi Monn� ]
This is really a general servlets question - Tomcat and all the other servlet containers are supposed to implement the servlet API which is very strict about this. You can download a PDF file of the servlet API from this Sun site. Anyway - you need to adjust your view of how servlets work. Typically there is only one instance of a servlet -each user request is parsed into a request object and the appropriate service (GET, POST, etc) is called with that request. Each request is processed in its own Thread - managed by the container. The servlet container also creates a response object for the request. You can manipulate which objects are shared in the various scopes - including having one object shared by all users of an application. This is all covered in the API. Bill
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com