0

I have a Java servlet from which I need to send few notifications to the HTML page before I send the final response (which is a PDF file).

Basically I need to keep the user updating on steps I am performing while generating the PDF for them.

I guess, one way could be set various attributes using HttpSession and have them printed using JS. But I don't know how to do that dynamically without loading the page again.

Any idea on how can this be done? I am kind of new to JSP and servlets.

3 Answers 3

5

There are two ways:

  • AJAX polling - you send ajax requests periodically, and the server responds. The page does not get refreshed. Check jQuery for an easy way to make ajax calls

  • Comet - that's an umbrella term for what you are trying to do. Usually it means keeping an open channel with the server. There are many ways to implement comet (including the option above), but in Java, on the server side, there are two things to check:

Sign up to request clarification or add additional context in comments.

Comments

0

You should probably look forward to use some implementation of COMET (with js library of choice).

Comments

0

If your html code is allowed to use html5 features, you could also use websockets

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.