title: How to maintain session between server and client when each servle end?
body: <p>i have develop servlet server and javaclient and want to know how to maintain session keep connecting. </p>
  
  <p>now, my javaclient will call my servlet and then server will return data back to client. after client process the data and then it will call the same servlet again for other process. But the server unable retrieve existing session. So i unable to verify the client who visit before.
  Is there any idea? here my environment:
  Server: apache + jrun4
  Client: java client</p>
  
  <p>it return null pointer when reqType = Login, i want to keep the same session for further processing</p>
  
  <pre><code>private void getReqParameter( HttpServletRequest request, HttpServletResponse response, RandomAccessFile logFile) {
  
  String sSessionID="", sReqType="";
  
  String sAddress1="", sAddress2="", sAddress3="", sID="", sPwd="", sSigID="";
  
  sReqType = (String)request.getParameter("reqType");
  
  HttpSession sess = request.getSession(false);
  if (sReqType.equals("HandShake")){
      sess = request.getSession(true);
      sSessionID = sess.getId();
      out.println(sSessionID);
      return;
  }
  
  sID = (String)request.getParameter("ID");
  sPwd = (Sring)request.getParameter("Pwd");
  sSigID = (Sring)request.getParameter("SigID");
  
  if (sReqType.equals("Login")){
      sess = request.getSession(false);  
      sSessionID = sess.getId();
      return;
  }     
  
  sAddress1 = (String)request.getParameter("A1");
  sAddress2 = (String)request.getParameter("A2");
  sAddress3 = (String)request.getParameter("A3");
  
  if (sReqType.equals("UpdProfile")){
      sess = request.getSession(false);   
      sSessionID = sess.getId();
      return;
  }     
  
  }
  </code></pre>