title: Serving HTML pages in a Spring Boot application
body: <p>I have a Spring Boot Application. I am trying to pass a variable to a HTML page but unfortunately I cannot seem to do it, on application start nothing is rendered except the static text: &quot;WORLD&quot;. My controller is as below:</p>
  <pre><code>@Controller
  public class IndexController {
      @RequestMapping(value = &quot;/index&quot;, method = RequestMethod.GET)
      public String index(Model model) {
          model.addAttribute(&quot;message&quot;, &quot;HELLO&quot;);
          return &quot;index&quot;;
      }
  }
  </code></pre>
  <p>And my index.html:</p>
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;h1&gt;${message}&lt;/h1&gt;
  &lt;h2&gt;WORLD&lt;/h2&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>I was looking for an answer and I found these articles:</p>
  <p><a href="https://stackoverflow.com/questions/15479213/how-to-serve-html-files-with-spring">How to serve .html files with Spring</a></p>
  <p><a href="https://stackoverflow.com/questions/16598594/how-to-map-requests-to-html-file-in-spring-mvc/32628600#32628600">How to serve html files with Spring</a></p>
  <p><a href="https://stackoverflow.com/questions/1483063/spring-mvc-3-and-handling-static-content-am-i-missing-something">How to handle static content in Spring MVC?</a></p>
  <p>These are useful examples, but in my project I don't have files such as: mvc-dispatcher-servlet.xml, web.xml, or even the whole WEB-INF directory.</p>
  <p>The files I have after creating a Spring MVC Project are in the screenshot below. Should I add the files mentioned in the above literature to fix this issue or what?</p>
  <p>My Project view via IntelliJ IDEA:</p>
  <p><a href="https://i.stack.imgur.com/jMA3R.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jMA3R.jpg" alt="Project Structure" /></a></p>
  <p>My pom.xml file:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
      xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;offersmanager&lt;/groupId&gt;
      &lt;artifactId&gt;webapp&lt;/artifactId&gt;
      &lt;version&gt;1&lt;/version&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;1.2.6.RELEASE&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;properties&gt;
          &lt;!-- Java version --&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
          &lt;!-- Use UTF-8 sources encoding --&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;!-- Local model --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;${project.groupId}&lt;/groupId&gt;
              &lt;artifactId&gt;model&lt;/artifactId&gt;
              &lt;version&gt;${project.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Spring boot --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;/artifactId&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
  
          &lt;!-- MAIN CODE SETTINGS --&gt;
          &lt;sourceDirectory&gt;src/main/java&lt;/sourceDirectory&gt;
          &lt;resources&gt;
              &lt;resource&gt;
                  &lt;directory&gt;src/main/resources&lt;/directory&gt;
                  &lt;filtering&gt;true&lt;/filtering&gt;
              &lt;/resource&gt;
          &lt;/resources&gt;
  
          &lt;!-- TEST CODE SETTINGS --&gt;
          &lt;testSourceDirectory&gt;src/test/java&lt;/testSourceDirectory&gt;
          &lt;testResources&gt;
              &lt;testResource&gt;
                  &lt;directory&gt;src/test/resources&lt;/directory&gt;
              &lt;/testResource&gt;
          &lt;/testResources&gt;
      &lt;/build&gt;
  
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;spring-releases&lt;/id&gt;
              &lt;url&gt;https://repo.spring.io/libs-release&lt;/url&gt;
          &lt;/repository&gt;
      &lt;/repositories&gt;
  
      &lt;pluginRepositories&gt;
          &lt;pluginRepository&gt;
              &lt;id&gt;spring-releases&lt;/id&gt;
              &lt;url&gt;https://repo.spring.io/libs-release&lt;/url&gt;
          &lt;/pluginRepository&gt;
      &lt;/pluginRepositories&gt;
  
  &lt;/project&gt;
  </code></pre>