lift's approach to dynamic content

lift has a "view first" rendering strategy. When a request comes in, an appropriate XHTML page is selected to satisfy the request. If there is a file in the path that matches the name (e.g., '/foo/bar.html'), that file is used. If there's no matching file, lift looks for a class named "Bar" in a number of packages. If the class isn't found, lift looks for foo.Bar in a number of packages. Once the rendering class is located, an instance is created and the "render" method is called. This allows HTML designers or programmers to maintain the files.

lift processes a number of special tags:

Once a page has composed its XHTML by getting renderings from each of widgets, links on the page are adjusted to the context page of the request. Additionally, if AJAX is enabled, forms marked as AJAX ready are re-written to use AJAX.

The code to embed the AJAX clock on the page is:

<lift:comet type="Clock">Current Time: 
<clk:time>Missing Clock</clk:time></lift:comet>

The Clock comet widget is:

  def render = bind("time" -> Text(timeNow.toString))

Which binds a string containing the current time to the "time" part of the XHTML and returns this as XHTML.