[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1372
  • Last Modified:

Page Expired problem in IE with multipart/form-data form

Hi,

I have a strange "Page Expired" problem in IE if I specify the enctype="multipart/form-data" in the form tag.

Assume that we have 3 JSP files i.e. david1.jsp, david2.jsp and david3.jsp. To make it very simple, david1.jsp will submit to david2.jsp and similarly, david2.jsp will submit to david3.jsp.

1. Specify the enctype="multipart/form-data" in david1.jsp
2. Submit to david2.jsp
3. Submit again from david2.jsp to david3.jsp
4. Finally go back from david3.jsp to david2.jsp (using history.back() javascript), I will get this "Page Expired".

However, if I do not specify the enctype="multipart/form-data" in david1.jsp, it works fine.

Can someone tell me what's the problem with it?

Thanks.
David
// david1.jsp
<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<html>
<head>
    <title>
        Web Application Page
    </title>
</head>
<body>
    <form method="post" enctype="multipart/form-data" action="david2.jsp">
    File to upload: <input type=file name=upfile><br>
    Notes about the file: <input type=text name=note><br>
    <input type=submit value="Submit to David2.JSP"> 
    </form> 
</body>
</html>
 
 
// david2.jsp
<html>
<head>
    <title>
        Web Application Page
    </title>
</head>
<body>
    <form method="post" action="david3.jsp">    
    <input type="button" value="Back to David1.JSP" onclick="javascript:history.back();">        
    <input type=submit value="Submit to David3.JSP"> 
    </form> 
</body>
</html>
 
 
// david3.jsp
<html>
<head>
    <title>
        Web Application Page
    </title>
</head>
<body>
    <p>
        <form method="post" action="david1.jsp">
        <input type="button" value="Back to David2.JSP" onclick="javascript:history.back();">        
        </form>
    </p>
</body>
</html>

Open in new window

0
suprapto45
Asked:
suprapto45
  • 2
  • 2
1 Solution
 
objectsCommented:
lots of info on expired pages here
http://shiflett.org/articles/how-to-avoid-page-has-expired-warnings
not sure if it will help or not.

0
 
suprapto45Author Commented:
Hi,

Thanks objects for the link. Will look into it and do hope that it will help.

Thanks.
David
0
 
objectsCommented:
if you google the problem (try "multipart/form-data, back, IE, Page Expired) you'll find lots of people with the same issue

0
 
suprapto45Author Commented:
Hi objects,

Okay, I solved my problems and thanks to some part of your link. Let me explain my solution so anyone can get benefit of it.

Certain things, I can solve it using the link that you provided (please refer to the "any form using the POST method submits to an intermediate processing page that redirects the user to a different URL"). It is actually manipulating different information to the IE (or any browser) history.

However, this does NOT work if you are passing some parameters to the next JSP as the previous solution just merely redirects the JSP. For this scenario, either you must change it to GET or use session instead. For this, you can use response.sendRedirect instead. It should not have the Page Expired problem.

Well, unfortunately, you must definitely draw some sacrifices to change your codes a bit though.

I think that is the best solution for now :).

Thanks.
David
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now