I stored employee details in memory not in DB by using Ajax.. after entering the records., if i press refresh button of the browser .,,all records will gone.. only empty textboxes page will appear.. When ever we press refresh button, a Unique ID will go to the servlet.,, if it is a new one., the logic of servlet will execute otherwise the servlet will able to display the previous web page with the content what ever we entered before.. that is my requirement.. I didn't use any framework.. i used only servlet...how to perform that one..!!!????? Any help would be appreciated greatly..!!!!!!!!!
What I have tried:
In my servlet "post" method:
------------------------------
RequestDispatcher dispatcher=null;
HttpSession session=req.getSession();
String GUID=req.getParameter("guid");
String PrevGUID=(String) session.getAttribute("guid");
System.out.println("-------------- GUID : "+GUID);
System.out.println("-------------- PREV GUID : "+PrevGUID);
if(GUID.equals(PrevGUID)){
System.out.println("-------------- 1-Same GUID");
/*String location = req.getParameter("url");
System.out.println("Location : "+location);*/
//dispatcher=req.getRequestDispatcher("http://localhost:8181/Employee/Added");
//dispatcher=req.getRequestDispatcher("/"+location);
dispatcher=req.getRequestDispatcher("DisplayDetails.jsp");
dispatcher.forward(req, res);
}
else{
System.out.println("-------------- 2-Diff GUID");
session.setAttribute("guid",GUID);
doGet(req, res);
}