Was going through some Java Servlets code.
I found attributes set and retrieved in 3 different ways.
req.getSession().setAttribute("var1","value1");
req.setAttribute("var2", "value2");
getServletContext().setAttribute("var3", "value3");
req
is a variable of type HttpServletRequest
I am a little confused as to what is the difference between the three?