Help me please.

Step 1: Write "Hello World!" - the application can be started and it displays in the log - "Hello World!".

Step 2: Write "Hello Server!" - the application starts the jetty server (on localhost: 8080). In the browser, you can open the localhost: 8080 page and see the string "Hello Server!".

Step 3: Edit the page that the server returns so that it overloads itself once a second. Move the page creation to a separate class (PageGenerator).

The first two steps figured out how to do it, but the third is completely incomprehensible. Tell me what to read on the topic, I want to understand how to do this.

The problem is that I don’t even know that I need to google. As I understand it, it is required to use servlet api for every second page restart. I do not ask for a ready-made solution, but at least what is required for this to be used.

    1 answer 1

    You can google, for example, like this "java servlet auto reload page".

    There are 3 ways:

    1. Set the "Refresh" header response.setIntHeader("Refresh",1); .
    2. Set meta tag on page <meta http-equiv="refresh" content="1" /> .
    3. With the help of javascript functions setTimeout and location.reload .