Dynamic Web Development with Seaside

3.6.8Rendering the Behavior

Interactions between the browser and Seaside are done using callbacks in the Smalltalk code, and these are entered, directly or indirectly, in the WAComponent>>renderContentOn: method.

In the System Browser select the method and edit it to:

WebCounter>>renderContentOn: html 
html heading: count.
html anchor
callback: [ self increase ];
with: '++'.
html space.
html anchor
callback: [ self decrease ];
with: '--'

This adds two anchors with increment (++) and decrement (—) links that call back to our increase and decrease methods. Save the method. Then go back to the web browser and refresh the page to see the change.

A counter with action

Click the new links a few time to verify that it works.

That’s it. You developed your first Seaside component in VisualWorks.

Copyright © 19 March 2024 Stéphane Ducasse, Lukas Renggli, C. David Shaffer, Rick Zaccone
This book is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 license.

This book is published using Seaside, Magritte and the Pier book publishing engine.