Multiple Choices
Answer (Choose 1 answer)
<
Ex
Consider the following doGet method code of a servlet:
public void doGet(HttpServletRequest req, HttpServletResponse res)
String command = req.getParameter("command");
if("remove".equals(command))
{
}
HttpSession session = req.getSession();//insert code here
If the command equals remove, you want to remove all the attributes from the session. Whic option will you use? (Choose one)
A. session.removeAll();
B. session.invalidate();
C. Enumerate the attribute names and remove them one by one from the session using removeAttribute(name) method.
D. session.unbind();