title: How to enable CSRF token with Spring Boot
body: <p>I am using Spring Boot 2.1.1. I think <a href="https://docs.spring.io/spring-security/site/docs/5.0.10.RELEASE/reference/htmlsingle/#csrf" rel="nofollow noreferrer">CSRF protection is enabled by default</a> for this version of Spring Boot (correct me if I'm wrong). I am trying to set up CSRF protection for my java web application, but I'm not exactly sure what changes I need to make in order for the CSRF token to show up.</p>
  
  <p>I am trying to check for the CSRF token via the browser. However, it seems the name and value of the token is showing up as blank.</p>
  
  <p>My jsp code:</p>
  
  <pre><code>&lt;table&gt;
      &lt;c:forEach items="${model.containerObjects}" var="file"&gt;
          &lt;tr&gt;
              &lt;form action="/path/container?fileName=${file.getName()}" method="post" id="${file.getName()}"&gt;
                  &lt;input form="${file.getName()}" type="hidden" value="${file.getName()}" /&gt;
                  &lt;input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/&gt;
                  &lt;td&gt;&lt;a href="javascript:{}" onclick="document.getElementById('${file.getName()}').submit()"&gt;${file.getName()}&lt;/a&gt;&lt;/td&gt;
                  &lt;td&gt;${file.getContentLength()}&lt;/td&gt;
                  &lt;td&gt;${file.getLastModified()}&lt;/td&gt;
              &lt;/form&gt;
          &lt;/tr&gt;
      &lt;/c:forEach&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>However, the line where (I assume) the CSRF token should be on the front end looks like:</p>
  
  <pre><code>&lt;input type="hidden" name="" value=""&gt;
  </code></pre>
  
  <p>I've also made sure the backend method corresponding to this endpoint is annotated with @POST. Is there anything else I'm missing?</p>