Write a code snippet that gets an HttpSession object from a
Write a code snippet that gets an HttpSession object from a request object, uses the session object to set an attribute named orderNumber to the value of a variable named orderNumber, retrieves the orderNumber as a string from the session object, and then finally uses the session object to remove the orderNumber attribute.
Solution
 // getting session object fron request
HttpSession session = request.getSession();
// setting orderNumber in session with name \'orderNumber\'
session.setAttribute(\"orderNumber\", orderNumber);
//getting orderNumber from session
 // getAttribute return Object so need to typecast
 String orderNumber = (String)session.getAttribute(\"orderNumber\");
// removing orderNumber
 session.removeAttribute(\"orderNumber\");

