title: java- how to initialise session in second servlet (to get data stored by first servlet in session variable)
body: <p>I am storing a variable in session data, from a servlet where the user tries logging in to my application. Now I want to retrieve the user data from session, in another servlet in the same application. </p>
  
  <p>How do I initialise the session variable in the second servlet? Taking "request" as the "HttpServletRequest" do I code the session variable as "HttpSession session = null;" or as 
  "HttpSession session = request.getSession(true);"? Or is it some other way?</p>
  
  <p>Note that in the application flow, the user goes to an external page from the first servlet, and from the external page he is redirected to the second servlet. (The external page basically logs in the user via oauth in Google/Yahoo/Hotmail etc).</p>
  
  <p>Does this mean that I cant use session variables in this case? Do I Have to use application scoped variables?</p>
  
  <p>Please excuse me if my question sounds dumb, today is only the 3rd day of my starting coding in Servlets...</p>