I don't want to store objects in session.......

Hi,I don't want to save my objects in session or in the request ... yet I want to access it from the next JSP page. Is there any way of doing so.....?Ardhendu........ ; -)
[200 byte] By [Ardhendu] at [2007-9-26 7:46:39]
# 1
I don't think this is possible... at least there is no easy way out.One thing you can try.... serialize your objects into some persistant storage and deserialize them again. However it is quite slow and probably not worth the effort.Shubhrajit
shubhrajit_c at 2007-7-1 17:55:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

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 ;

coloumn at 2007-7-1 17:55:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

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

Ardhendu at 2007-7-1 17:55:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Hi try using SQLJ or JDORegds, Srikanth
sribk at 2007-7-1 17:55:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

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

maleev at 2007-7-1 17:55:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
Try to put ur object in the application scope...But be careful these objects remain through ur entire application, which may lead to performance problems..
soorej1 at 2007-7-1 17:55:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7

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.

lotar at 2007-7-1 17:55:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8
How about writing code so the object writes itself out as an XML string, which could be put into the HTML page as a hidden form field.When the form is posted to the server, parse the XML from the hidden field and then re-inflate the object.
jpardi at 2007-7-1 17:55:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...