How do I make the session data serializable

删除回忆录丶 提交于 2019-12-08 01:38:45

问题


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.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


回答1:


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 {
}


来源:https://stackoverflow.com/questions/7444463/how-do-i-make-the-session-data-serializable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!