Search code examples
javaservletsjspx

How to refresh a folder using java


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?


Solution

  • 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.