password and forwards the users to
restricted pages on confirmation. i ve uploaded the application on eatj.com for testing, now my problem is that
the session creation code is not working in Internet Explorer.means every time i refresh the page or go to some
other page, session id changes. But it is working perfect in other (Firefox, opera and netscape ) browsers. my
cookies are enabled and the code is working fine in my
development machine with I E. More over i ve tested this program on atleast 10 different machines with the same results so cookies being turned off is out of question. Any guesses what cud be wrong. cud it be some problem
in the eatj.com site.
here is my code
public class Login extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { String username = request.getParameter("username"); String password = request.getParameter("password"); if(username.equals("admin")&&password.equals("admin")) { HttpSession session = request.getSession(); System.out.println("session id "+session.getId()); session.setAttribute("username", username); RequestDispatcher dispatch = request.getRequestDispatcher("Welcome.jsp"); dispatch.forward(request, response); } else { response.sendRedirect("index.jsp"); } } }
It just checks for the hardcoded username and password and forwards the 'admin' user to welcome.jsp page where i am printing the session id and the username with welcome message. That id stays same for all the browsers except Internet Explorer, as when i refresh the page in IE i get a new session id.