Dynamic Web Development with Seaside

Buy PDF Buy Print

2.4.5Registering as a Seaside Application

We will now register our component as an application so that we can access it directly from the web browser. To register a component as an application, we need to send the message register:asApplicationAt: to the class WebCounter we created. We don’t need to define the method because it is already defined for us on the WAComponent class which is the superclass of our WebCounter class. The argument we add to the register:asApplicationAt: message will specify the root component and the path that will be used to access the component from the web browser.

WAAdmin register: WebCounter asApplicationAt: 'webcounter' will register the component WebCounter as the application named webcounter. You can reach the application under the URL http://localhost:8080/webcounter.

Use World | Workspace to open a workspace, which is an area where you can run snippets of code. Type the text shown above, then select it with the mouse and bring up the context menu and select Do it (d), alternatively use the keyboard shortcut.

Register a component as an application from a workspace

Now you can launch the application in your web browser by going to http://localhost:8080/webcounter/ and you will see your first Seaside component running.

If you’re already familiar with HTML, you may want to look at the introduction to halos in Section 7.2 to learn a little more about how to investigate what’s happening under the covers.

Add a Note

Copyright © 2 September 2010 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.