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.
Hello, I have this slight issue. I am using AJAX to get the value of a variable from my servlet, this variable is an integer. The program works great. But I want a new servlet instance to be reloaded each time I refresh my jsp page. For instance, when the program runs, the value of an integer, say x, starts from 0 and increments to maybe 3 which is supposed to be the maximum value for x. My idea is that if the user uses the browser refresh button, it will uses a totally new servlet instance and remove the old one. So that If I reload the page and try to retrieve the value of x, the value returned will be zero and not 3. ANy ideas?
Igwe, I don't understand what you are trying to do. User information is typically in the session, not the servlet. I can't imagine why it would matter which servlet instance a user gets. Maybe you could explain the goal of what you are trying to accomplish?
Restarting with a new clean slate on every request - you have to abandon this idea when working with Servlets.
I came to Servlets from the CGI side - i know this feeling when you run into the traps of multithreading.
But it simply isn't the way things are done with Servlets.
You would have to pay such a high performance penalty that it isn't worth the pain. I think you might even succeed in fiddling your configuration to reload on each request. At least i suppose you could do that - never tried.
But that's a bit like fixing wallpaper with nails. It works - admitted, but... well :-)
You have to dig your teeth in the Servlet issues multithreading, variable scope and clean design.
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