title: Freemarker: Dynamically generate content based on object fields
body: <p>I am new to Freemarker. I want to dynamically generate the content in FTL, so that it will display all the fields in the object. In Java we can achive this through reflection. Not sure in Free marker.</p>
  
  <p>Example:</p>
  
  <pre><code>class Employee{
  String name;
  String age;
  
  //setter and getter methods
  }
  
  class Organization{
  String orgName;
  String location;
  
  //setter and getter methods.
  }
  </code></pre>
  
  <p>I want to write common ftl file which will display all the objects fields irrespective of data types.</p>
  
  <p>I do not want to write in as below. I want it to be generic.</p>
  
  <pre><code>&lt;td&gt;&lt;div&gt;${employee.name!}&lt;/div&gt;&lt;/td&gt;
  &lt;td&gt;&lt;div&gt;${employee.age!}&lt;/div&gt;&lt;/td&gt;
  </code></pre>
  
  <p>Any help will be really appreciated.</p>