Thanks for your quick response. I've added in config : always-save-session this way :
<session-config use-persistent-store="true" always-save-session="true" /> and also in jsp : session.setAttribute("cur",cur);//will save the data when the color is changed. The color is still not saved correctly. I prefer to use setAttribute to save the session, for performance reason, but neither methods work for me. Maybe I miss something, but I really would like to understand this since we are in the process to publish a new application with load balancing. Thanks Scott Ferguson wrote: > > On Sep 18, 2006, at 6:25 AM, Riccardo Cohen wrote: > >> Hi >> In my application, I found that persistance did now work always. The >> first session info is >> correcly stored, but not after a change. >> So I made a little application that demonstrate that. And it appears >> that a simple string >> is correctly stored, while an object containing a hashtable is only >> stored at creation time. >> I use resin3.0.18 pro/sun jdk 1.5.0_06-b05 standard edition, and test >> persistancy simply >> by quitting and relaunching resin. > > That's normal, unless you add <always-save-session> to the > <session-config> or call setAttribute each time the object changes. > > The issue is that Resin can't know that an internal value in a session > object has changed unless it serializes it. Since the serialization is > fairly slow, by default Resin only saves the session if it's told the > session has changed, either by calling setAttribute or by having the > <always-save-session> enabled. > > -- Scott >> >> Here is a sample coded storing simple strings in the session: >> >> ///////////DIRECT ACCESS////////// >> >> // get current session color >> String session_color=(String)session.getAttribute("color"); >> if (session_color==null) >> { >> session_color="FFFFFF"; >> session.setAttribute("color",session_color); >> } >> else >> System.out.println("GOT FROM SESSION"); >> // get parameter for user action >> String newcol=request.getParameter("changecolor"); >> if (newcol!=null) >> { >> System.out.println("GOT FROM PARAM"); >> session_color=newcol; >> session.setAttribute("color",session_color); >> } >> >> In that case, the string session_color is correct after stop/start, >> the color is well >> memorized. >> >> Now an example using an object of mine : >> public class myobj implements Serializable >> { >> Hashtable<String,String> hash; >> public myobj() >> { >> hash=new Hashtable<String,String>(); >> } >> public Hashtable<String,String> get_hash() >> { >> return(hash); >> } >> } >> This object will be inserted in the session : >> ///////////WITH HASH TABLE////////// >> >> <jsp:useBean id="cur" class="myobj" scope="session"/> >> <% >> // get current session color >> String session_color=cur.get_hash().get("color"); >> if (session_color==null) >> { >> session_color="FFFFFF"; >> cur.get_hash().put("color",session_color); >> } >> else >> System.out.println("GOT FROM SESSION"); >> // get parameter for user action >> String newcol=request.getParameter("changecolor"); >> if (newcol!=null) >> { >> System.out.println("GOT FROM PARAM"); >> session_color=newcol; >> cur.get_hash().put("color",session_color); >> } >> >> Here the session_color is corretly save at first connection, but when >> I change (in the >> app) my color, and then stop/restart resin, the color saved is the >> first one. >> >> Thanks for any help about this, I can provide full source code in a zip. >> >> --Très cordialement, >> >> Riccardo Cohen >> ligne directe : 02-47-49-63-24 >> ------------------------------------------- >> Articque >> http://www.articque.com >> Moulin des Roches >> 37230 Fondettes - France >> tel : 02-47-49-90-49 >> fax : 02-47-49-91-49 >> >> _______________________________________________ >> resin-interest mailing list >> resin-interest@caucho.com >> http://maillist.caucho.com/mailman/listinfo/resin-interest > > -- Très cordialement, Riccardo Cohen ligne directe : 02-47-49-63-24 ------------------------------------------- Articque http://www.articque.com Moulin des Roches 37230 Fondettes - France tel : 02-47-49-90-49 fax : 02-47-49-91-49 _______________________________________________ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest