|
Loading the Web Toolkit |
|
|
Before any development with the Web Toolkit can begin, we must first turn your
workstation into a VisualWorks web server.
|
||||||||
|
This lesson explains how to create a Web Toolkit development environment.
|
||||||||
|
1.
If VisualWorks is not already running, please start running it now.
2. From the main VisualWorks window, select the menu option Tools/Load Parcel Named... 3. In the next dialog box, enter * and click OK. When the next window appears, scroll down to WebToolkit 7.2, highlight it and click the OK button.
Figure 1. Specifying the Web Toolkit parcel When you return back to the VisualWorks launcher, a new button will have been added to the toolbar.
Figure 2. The VisualWave Web Server Console button 4. Click VisualWave Web Server Console button. A new window will appear.
Figure 3. The VisualWave Server Console window 5. Click the Create Server button. 6. Change the Server Type to WaveHttpRequestBroker and click the Create and Start button. You should then see a screen like below.
Figure 4. Starting a Wave Http web server 7. Minimize all VisualWorks windows and open your favorite web browser. 8. In your browser address field, enter the following:
http://localhost:8008
9.
You should then see the following:
Figure 5. The VisualWorks WebToolkit Configuration Main Page |
||||||||
|
Congratulations!
You have successfully loaded the WebToolkit and have turned your workstation into a Smalltalk Web Server. Now we will test the web server to verify that it can successfully process a page that has Smalltalk code in it. |
||||||||
|
10.
Create a directory called sandbox under the web directory
(which is directly under the 'home directory' where you installed VisualWorks).
You can use any name you like but the screen shots and instructions in this tutorial
will use sandbox.
11. In your favorite text editor, enter the following and save this file as hello.ssp in the sandbox directory.
<html>
Note that this looks like a typical file of text and HTML tags except for the 9th line.
On this line, you will see percent tags. If you are new to Active Server Pages or
Java Server Pages, then this will be new to you as well. The percent tags are used to
tell the web server to stop pumping out a response stream (i.e. HTML) and to start
executing code. It will execute code starting from the opening percent tag (<%)
to the closing percent tag (%>).
<head> <title>My Little Sandbox</title> </head> <body bgcolor="white"> <center> <h1>Welcome to My Sandbox</h1> <p></p> The date today is <%= Date today %> </center> </body> </html> The equal sign used with a percent tag is a "shorthand" instruction for the web server to evaluate and display whatever expression follows it. In this case, it will evaluate the Smalltalk expression Date today and display it as normal HTML text (even though the expression Date today returns a Date object). Note that there is no slash character on the closing percent tag. Also, in this example, there can be no space between the opening percent tag and the equal sign because it is code that generates a result that is to be displayed as text. 12. From the VisualWorks Web Toolkit Configuration Main Page, click the link called Manage Sites. On the next page, in the section labeled Create a new site:, enter sandbox and click the Create New Site link.
Figure 6. Creating a new site 13. For the sake of simplicity, enter only the following options as follows:
Figure 7. Configuring the sandbox site 14. Click the Submit button. 15. The next page you should see will be the configuration page. Note: You know you have successfully configured the site if you see the hello.ssp file listed as a hyperlink on this page.
Figure 8. The Configuration page for the sandbox site 16. Click the hello.ssp hyperlink on this page. 17. You should see the following in your browser.
Figure 9. The hello.ssp page when processed by the WebToolkit web server. By the way: The extension ssp stands for "Smalltalk Server Page" and although it is simply a file with HTML and Smalltalk code in it, we will refer to this file as a "page". It is also acknowledged at this point that using the term "SSP page" is redundant (since this translates to "Smalltalk Server Page page"). Therefore, at the expense of offending the puritans of the English language, this tutorial will use both terms (SSP page and just SSP) when referring to a "Smalltalk Server Page" simply because at times, one sounds better than the other. |
||||||||
|
Congratulations!
You have successfully configured a Web Toolkit site and verified that an SSP page can be processed successfully. SummaryYou should now be able to:
|