What are the main differences between StringTemplate and FreeMarker?

I designed ST to build jGuru after getting sick of the “code in template” model of JSP. Velocity and friends (i.e., every other engine i think) give you more power than you need. I used basically four features to build jGuru.com (as described in paper). More features are unnecessary and lead you to entangle your … Read more

Velocity string function

You can invoke standard java methods on these objects. If s_attribute.name is type String you can directly use $s_attribute.name.toUpperCase() or for your specific case use $s_attribute.name.substring(0,1).toUpperCase() and $s_attribute.name.substring(1).toLowerCase()

JSP vs Velocity what is better?

@Vartec: I don’t think that the “strict separation of view from business logic” is a velocity feature that is not present in jsp. You can do business logic in jsp (more or less) but it’s not recommended at all. But I agree in your point regarding the syntax. Performance JSP is compiled to Java, so … Read more

Velocity, what’s the most efficient way to check if a string is empty and not null

If you just want Velocity to display the value if there, or display nothing if absent, a quiet reference by itself will do the trick: $!incentive.disclaimer If you’re wanting to explicitly test for empty, StringUtils from Apache Commons Lang can help. First add it to your Context (reference here): context.put(“StringUtils”, StringUtils.class); Though if you’re on … Read more

tech