How to do a page refresh in jsp after submit the action ?

Posted on 2011-05-02
Last Modified: 2012-06-21
I have a search jsp which will produce a report based on the search criteria, if the search criteria returns no record, it will display the message "no record found", but next time  when i change the search criteria, it will just generate a CSV report and page won't get refreshed, so the previous error message won't get cleared, I want to refresh the page to clear the error message.
Question by:Faiya
    LVL 26

    Accepted Solution

    It's not possible to do directly what you want.  The request to the server for the url either returns the page or the CSV file -- it can't return both.  If you try to refresh the page after the file is returned, some browsers will not get the entire file before the refresh.

    You'll have to approach your problem another way.  You can generate the CSV file and put a link to it in your page.  You can try making an Ajax call, although there are issues with browser behavior with that.  You can use Javascript to create a hidden iframe which tries to retrieve the file.

    Author Comment

    Thanks a lot mrcoffee365,
    In fact i just wanted to refresh the error filed on the page based on the search.
    Which i was able to do by playing with div in java script.

    But the proper way is that you have explained.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
    Read about the 3 stages of the buyer's journey: awareness, consideration, and decision.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now