Cookie[] cookies = request.getCookies();
String aa=request.getParameter("aa");
if(aa!=null){
int money = Integer.parseInt(aa);
int index =0;
for(int i=0;i<cookies.length;i++){
if("money".equals(cookies[i].getName())){
Cookie cookie = new Cookie("money", Integer.parseInt(cookies[i].getValue())+money+"");
response.addCookie(cookie);
index++;
break;
}
}
if(index==0){
Cookie cookie = new Cookie("money", ""+money);
response.addCookie(cookie);
}
}