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.

User Contributed Notes

"nunb <nandan (19 March 2010, 5:26 pm)

I am new to Seaside, so I may just be suffering from newbie confusion. However, after the sentence

 

> "need to send the message register:asApplicationAt: to the class WebCounter we created."

 

is the code

 

WAAdmin register: WebCounter asApplicationAt: webcounter

 

which, afaik, sends the register message to WAAdmin?

tpburke (28 January 2010, 1:32 pm)

For Seaside-2.8.4.app:

 

  register:asApplicationAt:

doesn't exist, but

  registerAsApplication:

does, so

  WebCounter registerAsApplication: 'webcounter'

works (as expected?).

 

This registers the webcounter as

  http://localhost:8080/seaside/webcounter,

not

   http://localhost:8080/webcounter

as shown in the text.

Add a Note

Copyright © 20 March 2010 Michael Davies, 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.