for going to the previous page. It works fine when i dont perform any action on Page2
But when i perform some action on Page2 it refresh itself so my window.history stored the previous URL of Page2 . So when i click on Back button I m directed to the Previous Page2 . But I want to go to Page1.
Well when you do an action, it adds it into history so the last page is the last state of that page. Nothing you can do about that. Only thing you really can do would be document.location.href = "thePage.jsp";