Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Handling Session Objects

Sawan

2007-08-03

Replies:


Hello experts,

I have following code...

JAVA class:
public class Support extends ActionSupport implements SessionAware
{
  protected Map<String, Object> session;
  public Map<String, Object> getSession() { return session; }
  @SuppressWarnings({"unchecked"}) public void setSession(Map session) {
this.session = session; }
}

Action class:
public class Child extends Support
{
ArrayList alt = new ArrayList();
alt.add("Test");
public String execute() throws Exception
{
  if ((ArrayList)session.get("obj")==null)
  {
  session.put("obj",alt);
  }
}
}

I have run this code first time and set the "alt" for this session only. Now
I copied the link from the browser window and paste it in other machines
browser. But unfortunately I also got the SAME "alt" on other machine's
browser.

I was assuming that for each new browser it will generate a new session and
will set new alt for each session.

Can any expert help me for this issue...

Thanks in advance

Sawan
--
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.