Answer the question
In order to leave comments, you need to log in
Why is a session immediately created in a webapp?
Why doesn't the if block work???
how does the session exist?
@WebServlet(name = "WarmStar", urlPatterns = "/warmStar")
public class WarmStar extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession httpSession = request.getSession();
if(httpSession == null){
System.out.println("dsdsdsdsdsdsdsdsdsdsdsssdsdsdsdsdsds");
}
System.out.println("111 " + request.getContextPath() + " dddddd " + request.getRequestURI() + "rrr " + request.getServletPath());
System.out.println("TYTYTYYTY");
request.getRequestDispatcher("index.jsp").forward(request,response);
}
}
Answer the question
In order to leave comments, you need to log in
Probably because if a get request (the doGet method) comes in, then it comes already inside the session?
And it comes with parameters: HttpServletRequest request, HttpServletResponse response
Well, further according to the scheme: HttpSession httpSession = request.getSession();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question