Why this JSP example doesn’t work with maven and Tomcat

Solution for Why this JSP example doesn’t work with maven and Tomcat
is Given Below:

I have just started self-teaching web development with Java. I followed the instructions of a book teaching Web development with Java and used the JSP example provided by the book. However, when run, the JSP doesn’t show the expected effects.

The source code for the JSP is as follows:

        <meta charset="utf-8">
        <title>First JSP</title>

                This is a simple HTML page that has a form in it.
                The hobby was received as: <strong>${param.hobby}</strong>
            Hobby: <input type="text" name="hobby" value="">
            <input type="submit" name="confirmButton" value="Confirm">

I could get the page “firstJSP.jsp” to show up in the Safari browser on my MacBook.

enter image description here

This may show that Maven and Tomcat are running. But when I entered a hobby in the text filed field after “Hobby:” on the webpage and pressed the “Confirm” button. The “${param.hobby}” text, which should have shown up there”, didn’t change into the hobby name I entered. This means that the JSP was treated as an ordinary HTML page.

The “firstJSP.jsp” file is in the directory shown below:

enter image description here

The book only gave the source code example and wasn’t clear about where the example should be placed in the project directory and how it should be used.

Please let me know where the problem lies and how to fix it. Thank you very much!