Search code examples
javahamlvelocityfreemarkerstringtemplate

Which Java HTML templating technology works in a way that is closest to Ruby (erb/haml)?


Among the Java templating solutions such as Apache Velocity, Freemarker, Hamlets, Tapestry, StringTemplate, JSP, JSP Weaver (others?) which would most closely approximate the conciseness and simplicity of similar HTML templating solutions in Ruby - haml/erb. I'm concerned both with the syntax of the templating engine as well as how simply it integrates with Controller code on the server.


Solution

  • i think what u are getting at is this

    ruby

    <% foreach vars do |var| %>
      <!-- some html code to do -->
      <%=h var %>
    <% end %>
    

    java

    <% for( int i = 0; i < vars.length; i++ ) { %>
    
       <%=vars[i]%>
    <% }  %>
    

    so the tags are similar

    for the a java side of the controller , views spring provides a way to separate them nicely