Building a UI with the Mustache template

The Mustache is a web template available for many languages, like JavaScript, Ruby, PHP, Python, Perl, Android, C++, Java, and so on, with a language-specific implementation. In our Blogpress application, we will use Mustache for JavaScript, so we need to include Mustache.js in the Blogpress application. Let's first understand the use case where Mustache.js is appropriate.

Quite often, to show dynamic values in HTML, we mix the data with HTML fragments and then update the DOM markup to show the final output. The following is the sample example for this approach:

$("#addAddress").live('click', function(){;       var oldAddress = "";//Assume that oldAddress value supplied from server side. var newContent = ...

Get Spring 5.0 Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.