In my spring project i have solved the backbutton issue using the below interceptor.
public class SampleInterceptor implements HandlerInterceptor
{
public SampleInterceptor() {
}
@Override
public void afterCompletion(HttpServletRequest arg0,
HttpServletResponse arg1, Object arg2, Exception arg3)
throws Exception {
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response,
Object object, ModelAndView model) throws Exception {
if(request.getMethod().equals("GET"))
{
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
response.setHeader("Pragma", "no-cache"); // HTTP 1.0.
response.setDateHeader("Expires", 0);
}
else if(request.getMethod().equals("POST"))
{
System.out.println("After post request : ");
}
}
}
I have cleared the browser cache for all request except post.Now user logged out and click back it does not go to the application only for get request.but post request it goes to the application.how to i avoid that problem in post request.If i cleared the browser cache for post request it asks confirm form submission.how to solve this issue? Any help will be greatly appreciated!!