aspose file tools*
The moose likes Struts and the fly likes storing an object into session variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "storing an object into session variable" Watch "storing an object into session variable" New topic
Author

storing an object into session variable

Masha Klimenko
Ranch Hand

Joined: Feb 04, 2004
Posts: 31
Does anyone know how I can store an object (Person) into a session in struts. If there are several ways, I 'd like to know them all. Specifically, can another web application access struts session and dump an object in there? (I'm new to Struts)
Thanks.


SCJP
Mathur Neni
Ranch Hand

Joined: May 10, 2004
Posts: 33
Here are two sol:
In the action class, using the request object (like in servlets), you can get the session object and can store the object in session.
If all the attributes in person belong to a separate form, then the form bean can be stored in scope by specifying in action mappings (default is session).
I don't think scope can be specified more than the application context.
Hope this may help you.
Can you elaborate on your question - Specifically, can another web application access struts session and dump an object in there?
Masha Klimenko
Ranch Hand

Joined: Feb 04, 2004
Posts: 31
I want to be able to receive an already constructed Person object from another application.
Mathur Neni
Ranch Hand

Joined: May 10, 2004
Posts: 33
This solution which i am mentioning here is out of Struts.
Make the object persistable in DB or Queue or ... and to retreive the object, interact with the persisted object from the Action class (or the back end code).
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Masha,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: storing an object into session variable