|
HttpSession session=ServletRequest.getSession(false); //获取Session
Map<String, String> cardMap=(Map)session.getAttribute("selectCard"); //获取属性
if(cardMap==null||cardMap.isEmpty()) //如果该属性为空
{
String []cardGUIDS=servletRequest.getParameterValues("ApplicationAddGUID"); //获取该GUID
if(cardGUIDS!=null&&cardGUIDS.length>0) //如果获取的值不为空
{
cardMap=new HashMap<String, String>();
for(int i=0;i<cardGUIDS.length;i++)
{
cardMap.put(cardGUIDS, cardGUIDS);
System.out.println("cardGUIDS==="+cardGUIDS);
}
session.setAttribute("selectCard",cardMap); //将值传递出去
System.out.println("cardMap========="+cardMap.size());
}
}
else
{
String []cardGUIDS=servletRequest.getParameterValues("ApplicationAddGUID");
if(cardGUIDS!=null&&cardGUIDS.length>0)
{
for(int i=0;i<cardGUIDS.length;i++)
{
cardMap.put(cardGUIDS, cardGUIDS);
System.out.println("cardGUIDS==="+cardGUIDS);
}
session.setAttribute("selectCard",cardMap);
}
System.out.println("newmap========="+cardMap.size());
} |
|