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.

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

Reply via email to