Introduction to WebMacro Templates

Here's an overview of WebMacro's powerful script language. You can also:

The Script Language

WebMacro's script language uses Java introspection to access data from the back-end servlet. In the example below, the variables (beginning with $) are completely resolved by WebMacro with no additional work by programmer or page designer.

The templates are parsed into an intermediate form for faster execution.

The script language is independent of XML/HTML. WebMacro's parser cannot be confused by an invalid XML/HTML document (which may become valid after processing); and an XML/HTML parser will consider WebMacro's script codes to be text. As a result, you can use many regular HTML editing tools to create the templates.

Finally, the script language focuses exclusively on page generation, preferring simple directed syntax over general programming power. Page designer can become absorbed with the art of designing a page, never having to look at program code.

There is no loss in generality, though, since WebMacro provides powerful support for programmers behind the template, in a standard programming language (ie: Java). Other technologies force programmers into using a hybrid language that is neither good for programming nor for page design.

The result is a script language that can be quickly learned by anyone coupled with a powerful back end programming language.

Here's a list of the advantages:

And here's example of a WebMacro template:

    #set ContentType = "text/html"
    <HTML><HEAD><TITLE>$Customer.Name</TITLE></HEAD><BODY bgcolor='white'>
    <h1>$Customer.Name: History<h1>

    Here's a list of your orders since $Customer.Orders.StartDate:

    <table width='70%'>
    <th><td>Order Date</td><td>Item Requested</td><td>Number of Units</td></th>
    
    #foreach $order in $Customer.Orders {
       <tr>
       <td>$order.Date</td> <td>$order.Item.Name</td> <td>$order.Number</td> </tr>
    }
    </table> </body> </html>

Notice how easy it is to edit attributes, such as table width or background.

Also notice that while there are a few programming concepts here (a loop) they are simplified, and focussed only on page layout. No higher level programming issues arise--the result being a clear, focussed expression of the page layout.

Since it's free, why not try it out!


On to WebMacro Programming


Introduction | Download

api | design | faq | goals | links | license | othertech | quickstart | script | status