Webpage Expired in Spring Framework MVC

I have a project based on the Spring Web model-view-controller (MVC) framework. Spring framework version Web-model-view-controller (MVC) 3.2.8 is deployed on a WebLogic server Version: 12.1.2.0.0

I have this form in 1 JSP

<form:form commandName="deviceForm" name="deviceForm" id="deviceFormId" method="post" action="${contextPath}/device/${deviceForm.device.id}" htmlEscape="yes" enctype="multipart/form-data"> 

I do a couple of things using the POST method .. after that I use the browser button (IE11) back and I got this error

 Webpage has expired Most likely cause: β€’The local copy of this webpage is out of date, and the website requires that you download it again. Something to try: Click on the Refresh button on the toolbar to reload the page. After refreshing, you might need to navigate to the specific webpage again, or re-enter information. More information More information If you continue to have this problem, try the following: 1.In Internet Explorer, click the Tools button , click Internet Options, and then click the Advanced tab. 2.Scroll down and clear the "Do not save encrypted pages to disk" option in the Security settings. 

I also tried redirecting the POST method

  response.setStatus(HttpServletResponse.SC_SEE_OTHER ); response.setHeader("Location", /device/" + device.id"); response.setHeader("Connection", "close"); response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1. response.setHeader("Pragma", "no-cache"); // HTTP 1.0. response.setHeader("Expires", "0"); // Proxies. return "redirect:/device/" + device.id"; 
+7
java spring internet-explorer spring-mvc
source share
5 answers

Just set the method form method to receive, and when you click the submit button, just change it to submit

+3
source share

If you make any request to a POST browser, you will always show that "The web page has an expiration date." If you update the POST request of the page, send all the parameters, so use the POST request only when you have a form to send or something that you cannot send to the url.

1) Convert all regular requests to a GET Request and save only the send request as a POST request.

0
source share

Add this tag to your html page:

<meta http-equiv="Cache-control" content="public">

More information here: https://support.microsoft.com/en-us/help/183763/error-message-warning-page-has-expired-the-page-you-requested ...

0
source share

The problem you're dealing with is that browser navigation follows general rules that are independent of your webapp logic.

There is no general way to solve this problem, but you can use javascript to change the navigation history to fit your logic.

In fact, you can replace the top element of your story so that there are no posts in your story.

This answer has a good example for this.

0
source share

This is actually a caching issue. You can decide as follows.

Offer # 1

BalusC made a decision using a filter. No need to add all jsp files. This will reduce your pain.

To disable the browser cache for JSP pages, create a filter that appears on the * .jsp url sample and is mainly executed in the doFilter () method:

 HttpServletResponse httpResponse = (HttpServletResponse) response; httpResponse.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1 httpResponse.setHeader("Pragma", "no-cache"); // HTTP 1.0 httpResponse.setDateHeader("Expires", 0); // Proxies. 

Thus, you do not need to copy data across all JSP pages and clutter them with scriptlets.

To enable the browser cache for static components such as CSS and JS, put all of them in a shared folder like / static or / resources and create a Filter that appears on the url-sample / static / * or / resources / * and does basically following in doFilter () method:

 httpResponse.setDateHeader("Expires", System.currentTimeMillis() + 604800000L); 

Resource Link: fooobar.com/questions/197751 / ...

Offer # 2

In your jsp file you can add. This will solve your problem.

 <% response.setHeader("Cache-Control", "no-cache"); response.setDateHeader("Expires", 0); %> 

Resource Link:

Add Expires or Cache-Control Header to JSP

Offer # 3

Microsoft Support Page Provides Browser Solution Similar Below

  • You can refresh the page to resubmit.
  • To resolve this issue, turn off "Do not save encrypted pages to disk" or obtain and install the latest version of Internet Explorer.

Resource Link: Error Message Solution: Warning: Page Expired: Page you requested

0
source share

All Articles