List list = new ArrayList();
list.add(id);
list.add(name);
list.add(country);
session.setAttribute("user",list);
取:
int id=Integer.ParseInt((List)session.getAttribute("user").get(0));
String name = (String)((List)session.getAttribute("user").get(1));
String country = (String)((List)session.getAttribute("user").get(2));
list.add(id);
list.add(name);
list.add(country);
session.setAttribute("user",list);
取:
int id=Integer.ParseInt((List)session.getAttribute("user").get(0));
String name = (String)((List)session.getAttribute("user").get(1));
String country = (String)((List)session.getAttribute("user").get(2));