Mission SCWCD. Mission SCJP Complete: SCJP 1.4 - 91%
cookies are stored in some temporary folder and each browser uses the encrypted information in the cookie while interacting with the server/container
Mission SCWCD. Mission SCJP Complete: SCJP 1.4 - 91%
package com.example.web;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class SessionTest extends HttpServlet
{
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
HttpSession session = req.getSession(); //this will not create session because cookies are disabled...
out.println("<html><body>");
out.println("<a href=\"" + res.encodeURL("session.jsp") + "\">click here</a>");
out.println("</html></body>");
}
}
<% if(session.isNew()) { %> This is a new session. The session id is <%= session.getId() %> <% } else {%> This is an old session <% } %>
Mission SCWCD. Mission SCJP Complete: SCJP 1.4 - 91%
I thought that even if i open a new window and say "http://localhost:8080/webapp/Result.jsp" i would get the old session.
When cookies are disabled, if we open the second page directly(not through 'href' in the first page) in a new browser by typing it's url in the address bar, the previous session won't be there(URL rewriting doesn't have a scope to work here)
But if cookies are enabled,the session management will work even if we open the second page url directly in a new browser by typing it's url in the address bar
Thanks,<br />-Rancy
A session will become invalid as soon as the user closes all browser windows-In HFSJ it is termed as FALSE
Mission SCWCD. Mission SCJP Complete: SCJP 1.4 - 91%
I think he's gonna try to grab my monkey. Do we have a monkey outfit for this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|