Discussions

Web tier: servlets, JSP, Web frameworks: How to submit the previous page?

  1. How to submit the previous page? (5 messages)

    I have an error page that show every error that occurs. My problem is how to know from where my error page was called, so my "back" button can back correctly with the parameters, because my actual "back" button show me "Warning: The page has expired"

    Greetings... Javier

    Threaded Messages (5)

  2. You may want to set the expiration date sometime in the future, so that the page would not expire immediately.
  3. You may want to set the expiration date sometime in the future, so that the page would not expire immediately.

    Ok. But my problem is: The previous page is generated with parameters and attributes, then i need to use that parameters and attributes to generate the same page again.

    When i try to go back from my error page, and i get the "expire message", i try to reload the page, a alert message is asking me if i want to resend the information to generate the page again, how can i do this automatically? There is some way to know what page (or action) called my error page to reload that page (or action)?

    advanced thanks!
  4. But my problem is: The previous page is generated with parameters and attributes, then i need to use that parameters and attributes to generate the same page again.

    When i try to go back from my error page, and i get the "expire message", i try to reload the page, a alert message is asking me if i want to resend the information to generate the page again, how can i do this automatically? There is some way to know what page (or action) called my error page to reload that page (or action)?
    Your page is generated in response to POST request, and has an expiration header with little or no valid time.

    1. My belief, shared by many others, is that it is not proper to reply with a meaningful page in response to POST request. Instead, you may want to receive POST request, process input data, store it somewhere on the server and redirect to a result page. In this case the result page will be loaded with GET request. If you store the data on the server, your result page will not have input parameters besides page ID or object ID.

    2. GET requests can be resent automatically, but when a POST request is resent, browser asks a user to confirm operation, this is what you see. So, if you use the redirect to your result page, you will be able to reload it without alert message, because redirect uses GET.

    3. As a workaround you may want to submit your form using GET instead of POST, see the type attribute in the form tag. In this case the form would be resubmitted automatically without messages, but you have to process double submit issues on the server.

    4. If you can control HTTP response header for this individual page, you may just set expiration time in the future, so the page would not be reloaded at all, but would be pulled from the cache.
  5. Ok... thanks a lot to all of you

    I'll try this...
  6. You can have a back button on your error page, link to the source page; user can go back to the page, and you can repopulate the page based on the session information.