Next: , Previous: Locales, Up: Packages


3.5 The Seaside web framework

Seaside is a framework to build highly interactive web applications quickly, reusably and maintainably. Features of Seaside include callback-based request handling, hierarchical (component-based) page design, and modal session management to easily implement complex workflows.

A simple Seaside component looks like this:

     Seaside.WAComponent subclass: MyCounter [
         | count |
         MyCounter class >> canBeRoot [ ^true ]
     
         initialize [
             super initialize.
             count := 0.
         ]
         states [ ^{ self } ]
         renderContentOn: html [
             html heading: count.
             html anchor callback: [ count := count + 1 ]; with: '++'.
             html space.
             html anchor callback: [ count := count - 1 ]; with: '--'.
         ]
     ]
     
     MyCounter registerAsApplication: 'mycounter'

Most of the time, you will run Seaside in a background virtual machine. First of all, you should load the Seaside packages into a new image like this:

     $ gst-load -iI seaside.im Seaside Seaside-Development Seaside-Examples

Then, you can start Seaside with either of these commands

     $ gst-load -I seaside.im --start Seaside
     $ gst-remote -I seaside.im --daemon --start=Seaside

which will start serving pages at http://localhost:8080/seaside. The former starts the server in foreground, the latter instead runs a virtual machine that you can control using further invocations of gst-remote. For example, you can stop serving Seaside pages, and bring down the server, respectively with these commands:

     $ gst-remote --kill
     $ gst-remote --stop=Seaside