Hi all,

My application uses a bean to store a collection of values to display
in a select input. Since the generation of this collection is
time-consuming, I set this bean to a session scope, and using the
following code :

in jsp:
<%@ taglib prefix="s" uri="/WEB-INF/struts-tags.tld" %>
<s:set name="myCollection" value="myCollection" scope="session"/>

in the Action (implementing Preparable and ServletRequestAware):
private Vector myCollection;
public Vector getMyCollection() {
   return myCollection;
}
public void setMyCollection (Vector v) {
   this.myCollection = v;
}
public void prepare() {
   ...
   setMyCollection( (Vector)
request.getSession().getAttribute("myCollection"));
   ....
}

This works perfectly as expected, as long as there is only one
instance of the application launched at a time in the same browser
(using Firefox or IE7 tabs for example). In that case, the bean is
shared between the different instances, which is problematic since its
content depends on previous data input.

I tried to change the scope of the bean, using "page" or "request".
Passing the bean from the Action to the jsp is ok, but I can't get the
jsp to pass it back to the Action.

Is there another interface I should implement in the Action, or
another tag I should use in the jsp? Or maybe there is a way to force
the creation of a new session when opening another instance of the
application?

Thank you all for the help,
alexis

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to