Template Filler - Programmatic Text Substitution

Over the last couple of years (when I have started dealing more and more with dynamic Web Site/Page generation) a common problem has surfaced. How to provide user uploadable pages/content that contained hooks or access to server based business logic, yet NOT allow the uploaded code the ability to do anything it wants (like you can with JSP). In all the cases, the teams eventually created an internal/proprietary approach that used a text template with tags that were interpreted by server side logic and substituted by the appropriate text.

This code is my attempt to provide a solution (that will NOT need to be recreated again and again).

With this version, a template is a String Array (where each entry represents at least one, and possibly multiple lines) with "substitution" fields. A "substitution" field is demarcated by ".%" and "%.". A "substitution" field, if it exists alone, at the beginning of a line, "may" be substituted by multiple lines.

Download options (vs 1.2) (as .zip):

JUnit used.

Individual Source Files:

This LiteSoft page sponsored by Smith's Net Services.