WebStringTemplates is an easy to use Java template engine that separates web page design from the servlet server coding. It defines a clean data interface between the the servlet/JSP and the web page.
In MVC (Model/View/Controller) terminology, WebStringTemplates splits the View between the Programmer and the Web Page Designer. WebStringTemplates' Data Interface Definition file defines what data is available and provides sample data for development purposes. Once this interface is defined as a HTML document, the Web Page Designer and the Programmer can independently do their jobs without interfering with each other. It is the Programmer's responsibility to ensure the data specified is available and correctly formatted, without having to worry about where it will be displayed on the page. It is the Web Page Designer's responsibility to display the data in a pleasing manner, with roll overs, drop down menus etc., but without having to worry about the actual data being displayed.
See "Why do I need WebStringTemplates" for why this is a significant improvement over the existing methods.
This documentation covers:-
Overview of WebStringTemplates
Why you need WebStringTemplates
WebStringTemplates for the
Web Page Designer
Everything the Web Page Designer needs to know and no more
the System Architect
How to define the WebStringTemplate data interface.
WebStringTemplates for the
How to program with WebStringTemplates and how to convert existing JSP and servlets.
There are two processes to go through when using WebStringTemplates, the development process and the deployment process. An outline of the development process is shown below.
The Data Interface Definition defines the what string data is available to be inserted in the output web page by the Web Page Designer. It also specifies the attribute names used to access this data and provides sample data for web page development. This Data Interface Definition file is in HTML format and can either be produced by a HTML editor by the System Architect as part of the specification process, or generated by WebStringTemplates from an existing JSP or servlet by the Programmer.
The Data Interface Definition file is then passed to the Web Page Designer to develop the web page template that will incorporate the data into the final output page. The development of the template is an iterative process of using an HTML editor to edit the page.st.html template and then viewing the resulting output. The command line utility, RunWST, continually updates the output page (every 2 secs.) to reflect the changes the Web Page Designer is making. The Web Page Designer does not need access to the servlet server to do the work.
When the Web Page Designer has finished, the completed template is handed back to the Programmer/System Architect for deployment. The deployment process is shown in the following figure
To deploy WebStringTemplates no special web server integration is needed. Just make the jar file accessible to your JSP or servlet. The WebStringTemplateGroup class loads the page template, and optionally the data file, and then inserts the data attributes output by the JSP or servlet to produce the web page. The data file provides a means of supplying default data to the template and for making lumps of formatted output data available to the web page without having to code it in the JSP or servlet. Both the template and the data are cached for improved performance.
If you are a Web Page Designer then look here for all you need to know about how to use WebStringTemplates.
If you are a System Architect then look here for the details of the Data Interface Definition for WebStringTemplates.
If you are a server side Programmer then look here for how to use WebStringTemplates in your JSP or servlets. The documentation also covers converting existing existing JSP pages to use WebStringTemplates.
WebStringTemplates is an extension of Terence Parr's excellent StringTemplate package. WebStringTemplates makes some small modifications to the syntax, adds the Data Interface Definition file and its parser, the Web Page Designer's interactive viewing tool, comment attributes, data filters, support routines to simplify converting existing JSP pages and servlets and this documentation. WebStringTemplate also uses Terence's Antlr complier generator to parse the Data Interface Definition file.
Although this manual's examples are producing web pages, there is no reason for you not to use WebStringTemplates to produce any type of output from XML to SQL, ASCII and Postscript. Even though the Data Interface Definition is in HTML format, the data it specifies can contain any Uincode character sequence.