• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

storing an object into session variable

 
Masha Klimenko
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mathur Neni
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to be able to receive an already constructed Person object from another application.
 
Mathur Neni
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic