Java Virtal

[ News ] rss

February 01, 2011

Mark Wielaard: New GPG key. Finally created a new GPG key using gnupg. The old one was a DSA/1024 bits one and 8 years old. The new one is a RSA/2048 bits one. I will use the new one in the future to sign any release tarballs I might create. pub 2048R/57816A6A 2011-01-29 Key f...

More »

February 01, 2011

Andrew Hughes: [SECURITY] IcedTea6 1.7.8, 1.8.5, 1.9.5 Released!. We are pleased to announce a new set of security releases, IcedTea6 1.7.8, IcedTea6 1.8.5 and IcedTea6 1.9.5. This update contains the following security updates: The IcedTea project provides a harness to build the source code from OpenJDK6 u...

More »

192021 22232425

[ Archives News
for 'Java Technology' ]

home > news > java technology > using stringtemplate: part 1 "an introduction to stringtemplate"

Using StringTemplate: Part 1 "An introduction to StringTemplate"

  Please note: I put forth SQL examples because they can be short and are easy to understand. As other have pointed out it is not advisable to build SQL with Strings, regardless of the technique used. What is StringTemplate? To quote the StringTemplate home page:           “StringTemplate is a java template engine for generating source code, web pages, emails, or any other formatted text output.” Great, but what is a “template engine”?           A template engine (also known as a template processor or a template parser) is a software component that is designed to combine one or more templates with a data model to produce one or more result documents (Wikipedia). To you and me that means that a template engine is an alternate way to generate complicated text. One that I feel is particularity useful. Before we dive into that, lets take a look at a few examples of traditional String construction in Java. First we have the trusty old “+” operator. String message = "Hello" + " World"; While convenient for small concatenations. It becomes a real pain when the embedded variable count of the amount of text increases.    String strSQL = "UPDATE customers SET customerName='" + name      + "', customerAddress='" + addre...

Date: May, 25 2010

Others News

© mobirise builder | website generator | easy free website builder | best website design software | bootstrap navbar template