Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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);
}
Posted
Updated 28-Jun-16 5:39am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900