I'm trying some little things on JSP and Servlets for a further project. But I'm now blocked by an idea, but I didn't found a perfect solution to make it works.
The idea is that in a JSP page I've a POST form for my Servlet, to search in some documents. So that the Servlet will create a thread to search in the requested document. But what happens if I want to see the evolution of the search (number of folders explored / total folders for example) meanwhile I continue the navigation on the app, so not on the same page ? I imagined a tooltip permanent on the UI, but i didn't found an exact solution to make it possible.
The solution I saw in some post is to use Ajax for asynchronous requests, but I would do the following :
- on the thread (model part) : search, and sometime perform a POST on the JSP page with the evolution of search as content of the POST
- on each JSP page : have something like a "wait for receive" in jQuery, and update the text each time I receive something.
like : Form search POST => Servlet : creates a thread, return on the page (no redirect ? ) Thread => POST on JSP page caught by a JS function => update text
But on some posts I always saw the revert function : jQuery/ajax post on something, and use data after...
Can someone give me the right way to do this ?
Many thanks !