「Java」getSession()でセッションオブジェクト作成、削除、取得のサンプル
1.インタフェースの定義
public interface SAMPLE_DATA {
  //セッション保存用key
  public String USERID_KEY ="USERID_KEY";
}
2.setAttributeでセッションの設定
public String funcA(){
   getSession().setAttribute(SAMPLE_DATA.USERID_KEY,"xxxx" );
      //some code
} 
3.removeAttributeでセッションの削除
public String funcB() {
  getSession().removeAttribute(SAMPLE_DATA.USERID_KEY);
   //some code
}
4.getAttributeでセッションの利用
public String funcC(){
  String sesRes =getSession().getAttribute(SAMPLE_DATA.USERID_KEY);
  //some code
}