Dynamic Web Development with Seaside

6.3.4Registering the Counter Component

Now we should register the component as an application so that we can access it directly from the url path that will be associated with it. To register a component as an application, we ask the administration interface class WAAdmin to do the work for us:

WAAdmin register: WebCounter asApplicationAt: 'webcounter'

will register the component WebCounter as the application named webcounter.

Note that this expression can also be added in the WebCounter class method initialize which is invoked when the class is loaded into memory:

WebCounter class>>initialize
WAAdmin register: self asApplicationAt: 'webcounter'

Now you can launch the application in your web browser by going to http://localhost:8080/webcounter, see Figure 51.

Simple-counter

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.