You can create a class that contain a static Object var which be set null first. like the following code.
public class XXX
{
public static Object tmp = null ;
}
suppose your object instance that will be kept defined as:
Class1 c1 = new Class1 () ;
then in your first jsp file. You can put you object instance into by:
XXX.tmp = c1 ;
and in your next jsp file. You can get it by:
Class1 var = (Class1)XXX.tmp ;
Hi,
If I use the solution from coloumn then whenever my class is invoked for the first time , the object will be assigned to the heap and will stay there until JVM shutdown. Also the data stored won't be session specific. Shubhrajit_c 's approach is also too cumbersome... he too admits that...
I am still waiting for a solution if possible
I am quite wondering why would you want to work without the session and request objects. They're integral part of the servlet engine.
Of course you can do without them, you just have to design a servlet engine of your own. The servlet engine is nothing more than a bunch of classes like your own. You can study the APIdoc /and if your engine is open source even the source/ and find the best decision.
Still curious to know the reason :-)
Anton
You could also write to files I suppose. And when the session that corresponds with the files is done, then the files are erased. I still don't see why you would do this though. The only difference would be that you're writing information to the server rather than the cookie on the user side. I've never had a problem with saving to a session or request object though.