Home  >  Q&A  >  body text

How to send report generated message to browser console in Java backend application?

<p>I have a Java backend application that has a button that generates a report when clicked. I want to provide real-time updates to the user during report generation. </p> <p>Specifically, when the button is clicked, I want to display a message in the browser console such as "<strong>Report generation started</strong>" and when the process completes" <strong>Report generation completed</strong>". Since the duration of report generation is variable, I also want to inform the user that we don't know how long it will take to generate the report. </p> <p>Can anyone provide guidance on how to implement this functionality using JavaScript or Java? What steps and code snippets are required to implement this kind of real-time messaging in the browser console? </p>
P粉593649715P粉593649715438 days ago605

reply all(1)I'll reply

  • P粉301523298

    P粉3015232982023-08-10 00:47:10

    I don’t know what your mark looks like, but I guess the button you are talking about looks like this:

    <button id="foo" onclick="generateReport()">点击我</button>
    

    Since you said that button is already generating a report, there must be a click handler. Here, I call it generateReport. In this function, it is assumed that an AJAX request will be made to your server to generate and download the report.

    When the AJAX request completes successfully, you will want to log that the report has been generated.

    I can’t explain more without seeing the code.

    reply
    0
  • Cancelreply