The problem is when is doing the same in JSP.Because I want to display the response as soon as a line is displayed and then the next response when next line is read(say after few seconds or minutes). But my JSP page will render only when the entire script runs. How can this be done using JSP.Please advice.
Since this Unix script runs for long time say 10 minutes, I want user to be displayed messages in between indicating the progress so far.(as messages recieved line by line from Unix script). But how to display partial output using JSP and then after period of time display the next output. I do not know AJAX.Is there a way of doing it using JSP?
Not the best user experience, be warned.
->My JSP page will have buffered Reader reading line by line and displaying this Variable.
--> JSP page will have auto refresh. for every second.
But still the JSP page will be rendered after the entire buffer reader is read? suppose from buffer reader i am reading line by line 1 to 10 at intervals of 1 sec, despite the auto refresh, the JSP page will be rendered at once only after completion of 10 seconds.
Then how to make this approach work.Please suggest if this is possible and i am misssing out something above?
Its quite an old article, and I never used them myself, but I think it fits your scenario.
Bear Bibeault wrote:Really, the correct way to do this is with Ajax. Refreshing the whole JSP page -- or screwing around with flushing on the server -- is an outdated, fragile, and unnecessarily complicated approach. Why not use modern technology as it is supposed to be used?
It seems like AJAX is the best way. Can you tell me how do we need to publish the output from servlet and display it line by line in sync with the console output using AJAX.