Apple WebObjects 3.5 User Manual

Page 94

Advertising
background image

Chapter 6

Creating Reusable Components

94

Figure 27. A Navigational Control

The HTML code for one page might look like this:

<HTML>
<HEAD>

<TITLE>World Wide Web Wisdom, Inc.</TITLE>

</HEAD>

<BODY>
Please come visit us again!

<!-- start of navigation control -->
<CENTER>
<TABLE BORDER = 7 CELLPADDING = 0 CELLSPACING = 5>

<TR ALIGN = center>

<TH COLSPAN = 4> World Wide Web Wisdom, Inc.</TH>

</TR>
<TR ALIGN = center>

<TD><A HREF = "http://www.wwww.com/home.html"> Home </a></TD>
<TD><A HREF = "http://www.wwww.com/sales.html"> Sales </a></TD>
<TD><A HREF = "http://www.wwww.com/service.html"> Service </a></TD>
<TD><A HREF = "http://www.wwww.com/search.html"> Search </a></TD>

</TR>

</TABLE>
</CENTER>
<!-- end of navigation control -->

</BODY>
</HTML>

Thirteen lines of HTML code define the HTML table that constitutes the
navigational control. You could copy these lines into each of the application’s
pages or use a graphical HTML editor to assemble the table wherever you need
one. But as application size increases, these approaches becomes less practical.
And obviously, when a decision is made to replace the navigational table with an
active image, you must update this code in each page. Duplicating HTML code
across pages is a recipe for irritation and long hours of tedium.

With a reusable component, you could define the same page like this:

Advertising