Using template in Underscore JAVA

218 Views Asked by At

How to use underscore java template library for using template in java.

Library : https://github.com/javadev/underscore-java

Sample Template:

<h2>
    <%- listTitle %>
</h2>
<ul>
    <% _.each( listItems, function( listItem ){ %>
        <li>
            <%- listItem.name %>
            <% if ( listItem.hasOlympicGold ){ %>
                <em>*</em>
            <% } %>
        </li>
    <% }); %>
</ul>

<% var showFootnote = _.any(
    _.pluck( listItems, "hasOlympicGold" )
); %>

<% if ( showFootnote ){ %>
    <p style="font-size: 12px ;">
        <em>* Olympic gold medalist</em>
    </p>
<% } %> 

How can populate this template in java.

Thanks.

0

There are 0 best solutions below