Open sourcing some projects
I recently started two new open source projects on googlecode.com. One of them is JdbcHelper which helped me a lot in working on the last project that I was developing. JdbcHelper is a very small library for performing common JDBC tasks. It is similar to Spring Framewors Jdbc Template module, but does not depend on any external library, so it may be your library of choice if you want a lightweight solution.
The other project, which is currently in active development is the Cambridge Template Engine. It is a template framework for Java which I’ve been dreaming about for more than a year. I started working on Cambridge in mid 2008. To be honest, I wasn’t able to devote enough time for it to make it a usable product for a long time. A few months ago, while struggling with JSP, I decided to get back on it and I’ve been working hard for a stable version. One of my colleagues working on istanbul.net already started using Cambridge in a project which will soon become online.
What makes Cambridge different from other template engines like Freemarker or Velocity? Well, first of all Cambridge was designed to generate especially HTML or other markup documents like XML. Cambridge knows the tag structure of your template documents even if they are not well formed. This allows you, as a developer, to use the scope of html tags that is already in the document instead of wrapping your html with external code or tags.
For instance, if you want a portion of html to be viewed based on a condition you would write something like this in JSP
<s:if test="conditionMet"> <div id="someDiv"> <strong>Some content</strong> </div> </s:if>
or
<%
if(conditionMet) {%>
<div id="someDiv">
<strong>Some content</strong>
</div>
<% } %>
It would also look like the one above if you were using PHP too. On the other hand, Cambridge knows where the div element starts and ends. So the same code in cambridge is written as this:
<div a:if="conditionMet" id="someDiv"> <strong>Some content</strong> </div>
The code above is a simple html document which can be viewed in any browser or html authoring tool without a problem. Unless absolutely necessary, Cambridge does not introduce any new tags to the template file. You only need to add extra attributes to your tags to associate some behaviours.
I am currently trying to improve the documentation for Cambridge and I need feedback for both of the libraries. Please report any bugs, feature requests or comments on the project pages.