HttpSession中可以跟蹤並儲存用戶信息,把值設置到屬性中,有2個方法:setAttribute(),getAttrribute();
例如:在一個方法中用session.setAttribute(“student”,student);在session中設置一個屬性名為student,值為一個名為student的對象。而后可在同一session范圍內用getAttribute(“student”)取出該屬性,得到student對象。
HttpSession中可以跟蹤並儲存用戶信息,把值設置到屬性中,有2個方法:setAttribute(),getAttrribute();
例如:在一個方法中用session.setAttribute(“student”,student);在session中設置一個屬性名為student,值為一個名為student的對象。而后可在同一session范圍內用getAttribute(“student”)取出該屬性,得到student對象。
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。