We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

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

suprapto45
suprapto45 asked
on
Medium Priority
1,411 Views
Last Modified: 2012-05-06
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

Comment
Watch Question

Java Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
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.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Hi,

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

Thanks.
David
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

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

Author

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
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.