可以将对象存储为JSF中的cookie吗?如果是这样,所述对象及其属性是否需要可序列化?
例如,假设在线商店中的购物车想要使用ArrayList<StoreItem>
并将数组和StoreItem
保存在一个Cookie中。
示例:
ArrayList<StoreItem> cart = new ArrayList<StoreItem>;
//StoreItems added to list
FacesContext.getCurrentInstance()
.getExternalContext()
.addResponseCookie("cart", cart, null);