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 an image like this:

     $ gst
     st> PackageLoader fileInPackage: 'Seaside'
     st> PackageLoader fileInPackage: 'Seaside-Development'
     st> PackageLoader fileInPackage: 'Seaside-Examples'
     st> ObjectMemory snapshot: 'seaside.im'

Then, you can start Seaside with

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

which will start serving pages at http://localhost:8080/seaside.

You can stop serving Seaside pages, and bring down the server, respectively with these commands:

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