Database Reference
In-Depth Information
HTML, for example). You still need only a different output function; data collection
remains unchanged.
• By prefetching the list items, you can make adaptive decisions about what type of
list to create. Although we are not yet to the point of discussing web forms, they
make heavy use of their own kinds of lists. In that context, having items in hand
before generating an HTML structure from them can be useful for choosing the list
type based on the list size. For example, you can display a set of radio buttons if the
number of items is small, or a pop-up menu or scrolling list if the number is large.
Unordered lists
An unordered list is like an ordered list except that browsers display all items with the
same marker character, such as a bullet:
• First item
• Second item
• Third item
“Unordered” refers to the fact that the marker character provides no sequence infor‐
mation. You can of course display the items in any order you choose. The HTML tags
for an unordered list are the same as for an ordered list except that the opening and
closing tags are <ul> and </ul> rather than <ol> and </ol> :
<ul>
<li> First item </li>
<li> Second item </li>
<li> Third item </li>
</ul>
For APIs in which you print the tags directly, use the same procedure as for ordered
lists, but print <ul> and </ul> instead of <ol> and </ol> . Here is an example in JSP:
<sql:query dataSource= "${conn}" var= "rs" >
SELECT item FROM ingredient ORDER BY id
</sql:query>
<ul>
<c:forEach items= "${rs.rows}" var= "row" >
<li><c:out value= "${row.item}" /></li>
</c:forEach>
</ul>
For APIs that provide tag-generating methods, call a different method to produce the
outer tags. For example, in Perl, create an unordered list by calling the CGI.pm ul()
function rather than ol() .
To write a utility function for unordered lists, it's easily derived from a function that
generates ordered lists because they differ only in the opening and closing list tags.
 
Search WWH ::




Custom Search