Java Exchange is dedicated to servlet-based technologies for Java. The current
focus is on servlet-based applications involving database backends. Database expertise is
centered around Oracle® and Solid®.
JSTemplate
JSTemplate allows you to create flexible templates from any URL source. The templates take advantage of free format, user defined tags.
One of the immediate problems encountered in designing Web Based applications is that of having HTML in your code or the alternative of having code in your HTML (as with ASP or JSP). After experimenting with both of these problems, I decided to build a very simple, straightforward solution that leverages the power of HTML without imposing arbitrary and rigid tag definitions. The result is JSTemplate. JSTemplate allows you to call up a template from any URL source and has two methods for the replacement of on-the-fly tags. Tags may be replaced only once (performance benefit) or as many times as you may specify.
Here are some sample tags:
- [MyTag] (A tag which is visible in the template and in the resulting instance if not replaced)
- <!MyTag> (A tag which is not visible in the template and remains invisible if not replaced)
- <!--MyTag>Some other text in here <--> (A tag which can be used to hide or display a section of HTML. Only the <!--MyTag> needs to be replaced to control the section of HTML)
- Think of your own tag to do just about anything you need to do without have ayy HTML in your code!
Benefits:- You can store and move your templates anywhere on the Internet. Have your Web server running on one machine and your templates on another.
- When used with Web Serving caching, this system can outperform systems that use file system based templates.
JSTemplate Source Code
Legal:
DbConnectionBroker, JDBCGlobalBroker and JSTemplate are written and distributed under the GNU General Public License which means that its source code is freely-distributed and available to the general public.
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Your comments and suggestions are welcome at marc@javaexchange.com.
Copyright © 1996, All rights reserved.
Marc A. Mnich marc@critters.com
Java and HotJava are trademarks of Sun Microsystems, Inc., and refer to
Sun's Java programming language and HotJava browser technologies, JavaExchange.com is not
sponsored by or affiliated with Sun Microsystems, Inc.