2.4.4Rendering a Counter
Now we can focus on Seaside specific methods. We will define the method renderContentOn:
to display the counter as a heading. When Seaside needs to display a component in the web browser, it calls the renderContentOn:
method of the component, which allows the component to decide how it should be rendered.
Add a new method category called rendering
, and add the method definition
WebCounter>>renderContentOn: html
html heading: count
We want to display the value of the variable count
by using an HTML heading tag. In Seaside, rather than having to write the HTML directly, we simply send the message heading:
to the html object that we were given as an argument.
As we will see later, when we have completed our application, this method will give us output as shown in Figure 10.