版权声明:不可转载,盗文必究 https://blog.csdn.net/weixin_43815507/article/details/89450037
【错误例子】
String s=session.getAttribute("key");
【正确写法】
String s=session.getAttribute("key").toString();
【转换成int类型】
String s=session.getAttribute("key").toString();
int n=Integer.parseInt(s);
或者
String s=session.getAttribute("key").toString();
int n=Integer.valueOf()(s);
具体parsetInt和valueOf的区别请看其他教程