Much of the content on the Web is textual or graphical material that doesnt change much over time. However, there is increasing demand for sites that publish ever-changing data: breaking news stories, up-to-the-minute stock quotes, or the current weather are good examples.
A typical website is organized like the one in Figure 2-1. A users Web browser requests pages using Uniform Resource Locators (URLs). These requests are sent over the network to the Web server, which analyzes each request and selects the appropriate Web page to return to the users browser. This Web page is simply a text file that contains HTML code. Using the HTML tags embedded within the file received from the HTTP server, the browser renders the page.
Figure 2-1 A static website
Static websites are easy to maintain. There are a number of tools in the market that allow you to create Web pages with a relatively small amount of effort. And, as long as the content of your pages doesnt change too often, it isnt difficult to keep them up-to-date. Dynamic websites, however, are a different situation. Without WebObjects, it would require many resources to stay up-to-date.
WebObjects is designed to allow you to quickly and easily publish dynamic data over the Web. You create Web page templates that indicate where on the Web page the dynamic data is to be placed. WebObjects fills in the content when the page needs to be generated in response to a request. The process is much like a mail merge. The information your applications publish can reside in a database or other data-storage medium or it can be generated at the time a page is accessed. The pages are also highly interactiveyou can fully specify the way the user navigates through them.
Figure 2-2 shows a WebObjects-based website. Again, the request (in the form of a URL) originates with a Web browser. If the Web server detects that the request is to be handled by a WebObjects application, it passes the request to an HTTP adaptor. The adaptor packages the incoming request in a form the WebObjects application can understand and forwards it to the application. Based upon Web page templates you define and the relevant data from the data store, the application generates a Web page that it passes back through the adaptor to the Web server. The Web server sends the page to the Web browser, which renders it.
Figure 2-2 A dynamic publishing website
This type of WebObjects application is referred to as Web-based, since the result is a series of dynamically generated Web pages.
Instead of using an HTTP adaptor, you can deploy applications through servlet containers. This approach allows you to take advantage of your servlet containers application deployment facilities. For more information on this approach, see JavaServer Pages and Servlets.