O'Reilly logo

Java 9 Cookbook by Nick Samoylov, Mohamed Sanaulla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

  1. If you have followed the group ID and artifact ID naming as mentioned in the Getting ready section, you will have a package structure, com.packt.boot_demo, and a BootDemoApplication.java main class already created for you. There will be an equivalent package structure and a BootDemoApplicationTests.java main class under the tests folder.
  2. Create a new class, SimpleViewController, under the com.packt.boot_demo package, with the following code:
        @Controller        public class SimpleViewController{          @GetMapping("/message")          public String message(){            return "message";          }          }
  1. Create a web page, message.html, under the location, src/main/resources/templates, with the following code:
        <h1>Hello, this is a message from the Controller</h1 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required