How to generate new session id with out extends HttpServlet class. Is it mandatory to extend HttpServlet class & Is it mandatory to genarate new session id with in doGet method
public class LoginSupport extends ActionSupport {
public void prepare() {
HttpSession session = ServletActionContext.getRequest().getSession();
session.invalidate();
//How to genarate new session id
}
}
After calling
HttpSession#invalidate(), you can create a new session by callingHttpServletRequest#getSession().For example
The next HTTP response from your server should include a new session ID, eg
From https://docs.oracle.com/javaee/7/api/javax/servlet/http/HttpServletRequest.html#getSession--