request.getAttribute("")返回的是object类型
int amount =(int)request.getAttribute("buyamount");
这种的转换方式一直会报错,需要强制解封装:
int amount = Integer.parseInt(request.getAttribute("buyamount").toString());
转float类型也是一样的道理
float money = Float.parseFloat(request.getAttribute("moneyamount").toString());