开发者

How do I make the session data serializable

开发者 https://www.devze.com 2023-04-05 13:32 出处:网络
Previously we have implemented sticky session. Here\'s the link on our environment: Sticky Session in apache doesn't work

Previously we have implemented sticky session.

Here's the link on our environment: Sticky Session in apache doesn't work

Our next task is to implement session replication.

We are current using tomcat example, cart.jsp to demonstrate this behavior.

It is said that all session attribute must implement java.开发者_Go百科io.serializable.

Do you have any tips on where to implement it? We are following this tutorial closely.

tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html


java.io.Serializable is a so-called marker interface. It contains no methods. So to make objects of some class serializable you don't have to implement anything. Simply add Serializable to the list of interfaces you class implements.

i.e.:

class MyClass implements Serializable {
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号