Forward Logo (image)       WebStringTemplates
      Previous Back Back Back Next


Why do I need WebStringTemplates?

For the Web Page Designer

JSP Quick-Start Guide for Windows by By Kevin Yank gives two reason why JSP is not more widely used

"To take full advantage of JSP, a (web page) developer must first be comfortable working in the Java programming language. Unfortunately, this can be quite an ask for Web developers who like to concentrate on design and dabble in a scripting language or two when necessary. There are lots of good online tutorials and books out there for people interested in learning Java, but the process can be time consuming and, depending on the individual, quite challenging, due to the nature of Java as a pure object-oriented language.

Setting up a server environment to develop and test JSPs can be a confusing task, especially since most of the documents written to guide users through the process are steeped in technical mumbo jumbo that assumes you already know JSP inside and out."

Kevin Yank then continues with a substantial article just on setting up the servlet server. If you are a web page designer, a quick glance through Kevin's article will convince you there must be an easier way.

WebStringTemplates solves both these problems for the Web Page Designer. WebStringTemplates provides a very simple means of putting server data in a web page without having to learn Java or a full blown macro language. WebStringTemplates provides a simple command line utility that continually updates the output web page as the Web Page Designer makes changes to the template html page. No server is required.

For the Web Page Designers this means they can concentrate on developing the web page look and feel without having to ask the Programmer to install each change in the server. With WebStringTemplates, the Web Page Designers don't even need access to a server to do their job. They use their normal HTML editing tools. They don't need to learn a whole new macro language either. WebStringTemplates has less than half a dozen commands, only two operators and no for loop or indexing. It is as simple as possible and no simpler.

For the System Architect

For the System Architect, WebStringTemplates' Data Interface Definition file provides a means of defining and controlling the project without limiting the creativity of either the Web Page Designer or the Programmer. The System Architect can concentrate on the data flow instead of the server code or web page design. He can also readily check for compliance, because he now has a clear, clean, interface specification to check against for both the web page design and the server coding.

For the Programmer

The Problems with JSP by Jason Hunter summarizes a number of the problems with standard JSP, two of which are:- i) it is too easy to mix Java Code in the JSP and ii) some Java Code is still required in JSP. He suggests using a template language to overcome these problems. However in the examples he gives he replaces the Java Code in the JSP with template language code in the template. WebStringTemplates leaves the code in the server where it belongs and uses the template to display the results.

For server-side Programmers, this means ridding themselves of all the messy HTML code, allowing them to concentrate on processing the request and preparing the results. WebStringTemplates strictly enforces the direction of data flow from the server to the web page. So the programmer no longer needs to worry about what the Web Page Designer is doing. Nothing the Web Page Designer can do will affect the Programmer's results (assuming there are no side effects from toString() and Java Bean get and is methods).

WebStringTemplates means Separate Development.

WebStringTemplates is designed to separate the web page design from the servlet server coding. It also defines the interface between the servlet/JSP and the web page. Once this interface is defined as a HTML document, the Web Page Designers and the Programmers can independently do their jobs without interfering with each other.

Why not use one of the other 'web macro' packages?

There are many reasons why using WebStringTemplates is preferable to other packages. Some of these are:-

WebStringTemplates has a Clean, Well Defined, Interface

WebStringTemplates has a clean, well defined, interface that is specified by the Data Interface Definition file in HTML format. The Programmer or System Architect specifies this interface and the Web Page Designer and Programmer works from it. This file can be either generated by hand as part of the design process or generated automatically by WebStringTemplate from an existing JSP or servlet. This Data Interface Definition file maintains all the hierarchical structure of the data and faithfully represents its content without resorting to XML.

WebStringTempates is not another language for the Web Page Designer to learn.

Other 'web macro' languages are just that, a whole new language with operators, for loops, indexing, coding blocks, comment conventions, variables etc. They try to turn the Web Page Designer into a programmer. On the other hand, WebStringTemplates just displays strings. It has an include mechanism to include other templates, an if statement you can use to optionally display a section of text, implicit looping over lists to display tables of results and the + operator to concatenate two strings and thats about it. Any programming is left to the Programmer. Of course Web Page Designers are free to use any of the existing HTML scripting languages in their pages.

WebStringTemplates is not tightly integrated with the server.

WebStringTemplates is essentially a stand alone add-on jar file that can be used with any Java servlet server. See the programming examples for how to convert an existing JSP or servlet to use WebStringTemplates. It is not hard and you will be pleasantly surprised at how freeing it is to strip out all that HTML from your code.

WebStringTemplates does not need a Running Server to Design Web pages.

WebStringTemplates' RunWST command line development tool, means Web Page Designers no longer need access to a running servlet server and the assistance of a programmer in order to design the web pages. They can work on their own machines using their standard tools. Most other 'web macro' packages require a running servlet server to host them.

What About Velocity?

"Velocity is a Java-base template engine" from Apache. While it espouses the separation between Web Page Designers and Programmers and uses Maps and Java Beans to pass the data to the template like WebStringTemplates does, Velocity still suffers from the failings of previous 'web macro' packages, mentioned above.

Velocity does not have the concept of a well defined data interface between the Programmer and the Web Page Designer. It is simple in WebStringTemplates to define the interface between the Programmer and the Web Page Designer as separate HTML document with data comments.

Velocity has a more complex, some would say rich, template language that includes macros, logic operators, for loops, indexing, maths operators, its own form of comments and allows the template to modify the data and add to the data. In WebStringTemplates the data cannot be modified by the template and the language is as simple as possible and no simpler. In WebStringTemplates valid comments are whatever are valid in the target output.

Velocity allows and promotes formatting of the data by the template. WebStringTemplate takes the view that the Programmer is better placed to know what is an appropriate format, for example what country this request came from and what the response date format should be. Velocity's formatting adds complexity to its template language from both the Web Page Designer's and the Programmer's point of view and muddies the separation between them.

WebStringTemplates has similar flexibility to Velocity when it comes to providing data via beans, maps, list, arrays etc. but in WebStringTemplates how the data is provided by the Programmer has no effect on the Web Page Designer. When using WebStringTemplates, the Web Page Designer only deals with strings.

WebStringTemplates has an interactive development tool for the Web Designer to use to write his/her page. Velocity, at present, does not provide this support to the Web Designer and needs a programmer/server to back up the web page development.

In summary, to use Velocity the Web Designer needs to learn another non-trivial language to write the pages and then needs access to a Programmer and a running server to test them at each iteration. On the other hand with WebStringTemplates, given the Data Interface Definition, the Web Page Designer can go away and come back with the completed template using his familiar tools and html code.



Forward Logo (image)       WebStringTemplates
      Previous Back Back Back Next

Contact Forward Computing and Control by
ęCopyright 2004 Forward Computing and Control Pty. Ltd. ACN 003 669 994