title: Passing value from controller to html in spring
body: <p>Hello I have a simple web page where I have a button and a text near to button. I need to change text when button clicked and get the new text from code.</p>
  
  <p>This is controller class from where I need to pass response:</p>
  
  <pre><code>@GetMapping("/stream")
      public String openStream(Model model) { 
          String response = service.openStream();
          model.addAttribute("stream", response);     
          return "mainpage";
      }
  </code></pre>
  
  <p>And here my html page, the value from controller must be instead of question marks:</p>
  
  <pre><code>&lt;div id="container"&gt;
    &lt;button class="button"
          onclick="window.location.href = '/stream';"&gt;Stream&lt;/button&gt;
    &lt;p align="center"&gt;?????&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Thanks in advance for your help.</p>
  
  <p>Edit:
  I tried ${stream}
  but getting it as text not value, please see screenshot:
  <a href="https://i.stack.imgur.com/FDDvb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FDDvb.png" alt="enter image description here"></a></p>
  
  <p>Edit 2: 
   I need pass String from the text area to doc variable in the controller. Please help.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div&gt;
  &lt;textarea rows="10" cols="100" name="description"&gt;&lt;/textarea&gt;
  button class="button" onclick="window.location.href ='/send';"&gt;Send&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>@GetMapping("/send")
  public String send(String doc) {
  
      service.sendDoc(doc);
  
      return "mainpage";
  }
  </code></pre>