可以将对象存储为JSF中的cookie吗?

时间:2014-04-09 18:20:08

标签: cookies jsf-2 serializable

可以将对象存储为JSF中的cookie吗?如果是这样,所述对象及其属性是否需要可序列化?

例如,假设在线商店中的购物车想要使用ArrayList<StoreItem>并将数组和StoreItem保存在一个Cookie中。

示例:

ArrayList<StoreItem> cart = new ArrayList<StoreItem>;

    //StoreItems added to list

    FacesContext.getCurrentInstance()
      .getExternalContext()
      .addResponseCookie("cart", cart, null);

0 个答案:

没有答案