0

I have a html page which allows user to input some parameters. Based on the input, html sends the data to the servlet. Servlets talks to the database, pulls the data from database and sends it back to the UI.

While it picks the data from database, I want to send an update to the UI with some message or using out.println etc that they will get the data soon..

I tried this:

BufferedReader br = new BufferedReader(new InputStreamReader (process.getInputStream()));
while((line=br.readLine())!=null) {
  response.getWriter().applend(line);
}

request.setAttribute("array", data);
RequestDispatcher dispatch = request.getRequestDispatcher("out.jsp");
dispatch.forward(request, response);

This is just printing the response as mentioned by the bufferedwriter but not forwarding to the jsp page. Any advice on how I can send both responses to the UI?

Sweet
  • 187
  • 3
  • 15

1 Answers1

-1

Data can be streamed back to the sever using something like the accepted answer here: How to stream text response to jsp from servlet?

John
  • 3,458
  • 4
  • 33
  • 54