« Previous | Next »

Static HTML Rendering with Seaside

15 Jan 2011

One of Seaside's distinctive features is that it generates HTML in Smalltalk, i.e., Seaside provides an API to produce HTML using Smalltalk code. This API can be used for generation of static web pages too:

| doc ctx root html |
String streamContents: [ :stream |
    doc := WAHtmlDocument on: stream.
    ctx := WARenderContext new document: doc.
    root := WAHtmlRoot new.
    root beXhtml11.
    root title: 'Static HTML Generation using Seaside'.
    root writeHeadOn: doc.
    html := WARenderCanvas new initializeWithContext: ctx.		
    html html: '<p>Seaside!</p>'.
    root writeFootOn: doc ]
Tags: Seaside

No Comments Yet