What is the difference between request.getSession(boolean create) and request.getSession()?
The request.getSession() returns the current HttpSession associated with this request, or if the request does not have a session, creates one new session.
The request.getSession(boolean create) returns the current HttpSession associated with this request or, if there is no current HttpSession and create is true, returns a new session. If create is false and the request has no valid HttpSession, this method returns null and no new session created.
There is actually no difference between the request.getSession() method and the request.getSession(true) method.
Most Recent jsp Faqs
- How to get the real requested URI from inside the error page?
- Can I define a method in a JSP page?
- What is the difference between request.getParameter() and request.getAttribute()?
- What is difference between page and pageContext in JSP pages?
- How to config a JSP file in web.xml?
- What is the difference between jsp:forward and response.sendRedirect?
- How to retrieve values from HTML form input elements in JSP?
Most Viewed jsp Faqs
- How to config a JSP file in web.xml?
- What is difference between page and pageContext in JSP pages?
- How to disable browser caching for a specific JSP?
- How to retrieve values from HTML form input elements in JSP?
- What is the difference between jsp:forward and response.sendRedirect?
- What is the difference between request.getParameter() and request.getAttribute()?
- How to get the current JSP page name?