U cann't depend merely on
java script as it may change browser to browser.So u handle it in application using process flow control i.e., write a class with a method setPageNo(), which is supposed to be called by every Jsp and
Servlet, sets page no's to all the Jsp's and servlets and pass that object through out ur application using session object and write methods like getPreviouspage() which gives previous page no, which we set already using setPageNo() and compare page no's and act appropriately. If request comes from the page which it shouldnt then throw it to error page with message.
Or u can totally block ur browser back button using following javascript stmt.
<SCRIPT Language="JavaScript">
window.history.forward();
</SCRIPT>
Anil
SCJP 1.5, SCEA, ICED (287,484,486)