a.jsp中设置了一个session为
int userID=3;
session.setAttribute("userID",userID);如何才能在b.jsp中获得这个session值int userID=(int)session.getAttribute("userID");
这句话提示我有错误。
int userID=3;
session.setAttribute("userID",userID);如何才能在b.jsp中获得这个session值int userID=(int)session.getAttribute("userID");
这句话提示我有错误。
String userID=(String)session.getAttribute("userID");
int userID=Integer.parseInt(userID);做个转换不就行了吗
int userID=3;
session.setAttribute("userID",userID);//这句话就有问题
应改为session.setAttribute("userID",new Integer(userID));
在b.jsp中
Integer userID=(Integer)session.getAttribute("userID");