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


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

Posted on 2011-05-02
Medium Priority
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 27

Accepted Solution

mrcoffee365 earned 1000 total points
ID: 35510082
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

ID: 35510165
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Will the future of mobile app development include the same trends as those most relevant today? Find out by checking out the 7 trends of the future.
If anyone asked you to network diagram of the internet, it was drawn in the form of a fluffy cloud which further became known as cloud computing. Popularly cloud computing is defined as workloads that run over the internet in a commercial provider’s…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

872 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