Dynamator Pure HTML for every page generation technology.

Hello World, Bean Version

This example demonstrates Dynamator's support for XML-based programming constructs such as JSP directives and actions. The HTML page from the Hello World example is used, but the Dynamator file is changed to use the 'jsp:useBean' and 'jsp:getProperty' elements.

Step 1: Create the HTML file

The same HTML is used as in the Hello World example:

Step 2: Update the HTML file to identify elements requiring server-side behavior

The same HTML is used as in the Hello World example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>Hello World</title>
<p id="DynamicText">Hello world

Step 3: Create a JavaBean to support the page

Normally you would create a JavaBean class to hold values displayed on the page. This example takes a short-cut and uses java.awt.Label as the bean class, since it's close enough.

Step 4: Create a Dynamator File

This Dynamator file is similar to that of the previous example, except for the 'jsp:useBean' and 'jsp:getProperty' elements.

<dynamator language="jsp">
    <%@ page session="false" %>
    <jsp:useBean id="subject" class="java.awt.Label">
      <jsp:setProperty name="subject" property="text"
          value="Hello World, says Dynamator!"/>
  <id name="DynamicText">
    <content><jsp:getProperty name="subject" property="text"/></content>

Step 5: Run dynamate

...\doc\tutorial\example01b_HelloWorld>java dynamate HelloWorld2.html

Tidy (vers 4th August 2000) Parsing "HelloWorld2.html"

HelloWorld.html: Doctype given is "-//W3C//DTD HTML 4.01 Transitional//EN"
HelloWorld.html: Document content looks like HTML 4.01 Transitional
no warnings or errors were found

Generated JSP file


In Action

If you are viewing this page in a servlet engine, you can see the generated page in action.


Dynamator allows modifiers to contain any arbitrary XML. So instead of standard JSP elements, we could have used JSP tag libraries, or XML elements for any other technology.

This example shows that Dynamator allows the server code implementation to change drastically without affecting HTML. Even more drastic changes could have been made; for example, we could even have changed implementation languages without any change required to the HTML.