1

I want to upload a image to server side and I stored it into a specific folder. But I cant display that uploaded image in jsp page without refreshing the folder. How can I solve this problem?

Ram23
  • 91
  • 2
  • 10
  • You need to use Ajax in one form or another for this, if you want parts of pages to be updated without refreshing. Look into the framework you are using to see if they have any components you can use. – Thorbjørn Ravn Andersen Mar 11 '12 at 15:23
  • possible duplicate of [Uploaded image only available after refreshing the page](http://stackoverflow.com/questions/8885201/uploaded-image-only-available-after-refreshing-the-page/8889096#8889096) – BalusC Mar 31 '12 at 11:37

3 Answers3

0

You have to cause your jsp to run again and read the folder content. I do not know what framework are you using if any bu generally you should do the following. I believe that you have HTML form with method=POST and input element of type file. Your user presses browse button, chooses file and then presses "upload" that causes the form to perform post. Then you return the view of your remote folder. You should run your jsp at the end of upload, so that user will see the JSP's output, i.e. the new content of your folder.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
AlexR
  • 114,158
  • 16
  • 130
  • 208
0

This sounds like normal browser caching behaviour. You might try adding a query parameter that contains a timestamp or random number to cause the browser to not show the cached page or try some of the no-cache pragmas and headers.

Java42
  • 7,628
  • 1
  • 32
  • 50
0

I am facing same problem, it is not because of browser. Because we need to refresh folder present inside eclipse's project. On uploading, image is saved in the desired place but the problem is, that path is not updated in the eclipse project folder. I need to manually refresh folder present in the eclipse.

  • you can do one thing. Please select window-preferences in ur eclipse and then select the option general then workspace and tick on the refresh options in it. – Ram23 Apr 06 '12 at 06:47