Friday, June 14, 2013

FreeMarker: An open alternative to JSP

Today I read a good article about FreeMarker - an alternative to JSP:

Some notes about performance which I were looking for:

- Much like JSP, FreeMarker compiles templates to improve runtime performance. Those templates are stored in memory in a format that leaves placeholders for dynamic data. The controller fills those placeholders with dynamic data from the model. For this purpose, the controller must have access to both the model and the view. Once the dynamic data is retrieved from the model, the controller will print the template to a given output stream.
- Once templates are compiled, you can process them in parallel, leading to a significant performance boost.

- For anything other than the most trivial projects, FreeMarker provides a TemplateCache interface, implementations of which act as a repository for precompiled templates.

- An additional feature of TemplateCache objects is that they automatically reload templates when the template source file has changed. That relieves you of having to start and stop the servlet engine when you need to make changes to the HTML.

JSP versus FreeMarker (official documentation):

Wednesday, June 5, 2013

Debugging JavaScript in Chrome

Let's have test.html:

   <script src=""></script>
   <script type="text/javascript" src="fun.js"></script>
   <button onclick="return simpleFunction();">Click me</button>
   <ul id="testId"></ul>

and fun.js:

function simpleFunction() {
  for (var i=0; i < 7; i++) {
   var html = '<li>' + i + '</li>';
  return false;