Documente Academic
Documente Profesional
Documente Cultură
This appendix describes the Java classes HtmlPage, HtmlForm, etc, which can
be used (particularly in Servlet-based systems) to generate web pages as part
of an internet application.
Figure B.1 shows the classes involved and their relationships.
HtmlComponent
Htmlltem
HtmlText
HtmlInput
HtmlBody
HtmlHead
HtmlPage
HtmiForm
HtmlTable
HtmlTableData
HtmlTableRow
HtmlBody
components.
330
HtmlHead This class describes the head tag of an H T M L page. The title of
the document is supplied as a string p a r a m e t e r in the constructor, eg:
HtmlHead
head
= new HtmlHead("hdd
entry");
para
= new HtmlItem("p")
for a paragraph.
HtmlPage This class describes complete web pages, with a header in HtmlHead
and a body in HtmlBody. The methods setHead(head : HtmIHead) and
setBody(body : HtmlBody) set these elements of the page.
HtmlTable This represents H T M L tables. It consists of a list of HtmITableRow
instances, a new row is added at the end of the table by the method addRow(
row : HtmlTableRow).
HtmlTableData This represents a cell in an H T M L table, most commonly, a
single piece of text. In the latter case the text is supplied as a p a r a m e t e r of
the constructor: HtmlTableData(text:String).
HtmlTableRow This represents a row of an H T M L table. It consists of a list
of cells which are HtmlTableData instances. A new cell is added to the end of
the row by the method addCell(cell : HtmlTableData).
HtmlText This describes text components. The text string and the tag are
supplied in the constructor HtmlText(text: String, tag : String). For example:
HtmlText
nameLabel
= new HtmlText("Name:","strong")
generates the text "Name:" in boldface font. Other qualifiers, such as font size
and colour, can be defined using setAttribute.