title: How to load value into Java from Freemarker?
body: <p>I want to get variable value from Freemarker before I generate it second time. Is this somehow possible?</p>
  
  <p>I have following Java code:</p>
  
  <pre><code>        Template temp = cfg.getTemplate("template.html");
          Map&lt;String, Object&gt; data = new HashMap&lt;&gt;();
  
          RestClient rc = new RestClient();
          String id = "";//here i need "my_long_id_from_freemaker" value from Freemaker
  
          String response = rc.somemethod (id);//returns list of items
  
          data.put("items", response );
  </code></pre>
  
  <p>My template:</p>
  
  <pre><code>&lt;#assign my_long_id_from_freemaker = "my_long_id_from_freemaker_value"&gt;
  &lt;div class="panel-body"&gt;
    &lt;#list items as item&gt;
   &lt;p&gt;${item.name}: ${item.id} &lt;button type="button" id="${item.id}" &gt;Details&lt;/button&gt;
      &lt;/#list&gt; 
  &lt;/div&gt;
  </code></pre>
  
  <p>And after page is generated for the first time, I want to be able to change value of "my_long_id_from_freemaker" and refresh page what will initiate another call of my java code.</p>