如果能,怎么放?

解决方案 »

  1.   

    要封装:
    int k=1324;
    session.setAttribute("abc",new Integer(k));
      

  2.   

    一般都是用封装形式int n = 90;session.setAttribute("NUM",new Integer(n));但是如果执意要要用int形式也是可以滴如:session.setAttribute("NUM","" + n);
      

  3.   

    一般都是用封装形式int n = 90;session.setAttribute("NUM",new Integer(n));但是如果执意要要用int形式也是可以滴如:session.setAttribute("NUM","" + n);
    =====================================================================================‘
    "" + n 是字符串
      

  4.   

    只能放对象变量。
    new Integer(k);生成了Integer对象
    "" + n;//生成了String对象
      

  5.   

    session.setAttrbute(String,Object)
    所以必须放对象.
      

  6.   

    session.setAttribute("XXX",new Integer(X));
    封装是最好的办法,相信我
     接分
      

  7.   

    对session只能放对象要想存放基本数据类型就要封装