Java tutorial
//package com.java2s; public class Main { private static long sessionId = -1; /** * get the current sessionID String * @return the current sessionID string, if session is smaller than 0, then return null */ public static String getSessionString() { if (sessionId > 0) return String.valueOf(getSessionID()); return null; } /** * get the current sessionID * @return the current sessionID */ public static long getSessionID() { // TODO expired the session return sessionId; } }