Table of Contents
This chapter briefly introduces the HTP package, and describes how to use the procedures and functions of the package.
HTP is used to generate HTML source code. This package generates HTML tags using procedures, and outputs the resulting source code. For example, HTP.HTMLOPEN creates the <HTML> tag, and HTP.HTMLCLOSE creates the </HTML> tag.
The Apache module, mod_tbpsm was implemented in Tibero 5.0. To process requests from the Apache HTTP server, the mod_tbpsm module calls the required HTP package procedures and returns the resulting HTML code.
To learn how to configure and use mod_tbpsm, refer to Tibero Application Developer's Guide.
This section describes the procedures and functions provided by the HTP package, in alphabetical order.
Creates the </BODY> tag that indicates the end of the body in an HTML document.
Details about the BODYCLOSE procedure are as follows:
Prototype
HTP.BODYCLOSE
Example
BEGIN HTP.BODYCLOSE; END;
This example generates the following HTML code.
</BODY>
Creates the <BODY> tag that indicates the start of the body in an HTML document, and this procedure can also change the document background by specifying the attribute.
Details about the BODYOPEN procedure are as follows:
Prototype
HTP.BODYOPEN ( background IN VARCHAR2 DEFAULT NULL, attributes IN VARCHAR2 DEFAULT NULL )
Parameter
Parameter | Description |
---|---|
background | Background attribute value of the <BODY> tag. This specifies the path to a background image file for the HTML document. |
attributes | Other attributes and values of the <BODY> tag. |
Example
BEGIN
HTP.BODYOPEN('/img/tibero.jpg');
END;
This example generates the following HTML code.
<BODY background="/img/tibero.jpg">
Generates the <BR> tag, which indicates a new line in an HTML page.
Details about the BR procedure are as follows:
Prototype
HTP.BR ( clear IN VARCHAR2 DEFAULT NULL, attributes IN VARCHAR2 DEFAULT NULL )
Parameter
Parameter | Description |
---|---|
clear | CLEAR attribute value. |
attributes | Other attribute-value pairs. |
Example
BEGIN HTP.BR; END;
This example generates the following HTML code.
<BR>
Generates the <CENTER> tag, text to centrally align, and the </CENTER> tag.
Details about the CENTER procedure are as follows:
Prototype
HTP.CENTER ( text IN VARCHAR2 )
Parameter
Parameter | Description |
---|---|
text | Text to centrally align on the web page. |
Example
BEGIN
HTP.CENTER('Tibero');
END;
This example generates the following HTML code.
<CENTER>Tibero</CENTER>
Generates the </CENTER> tag.
Details about the CENTERCLOSE procedure are as follows:
Prototype
HTP.CENTERCLOSE
Example
BEGIN HTP.CENTERCLOSE; END;
This example generates the following HTML code.
</CENTER>
Generates the <CENTER> tag.
Details about the CENTEROPEN procedure are as follows:
Prototype
HTP.CENTEROPEN
Example
BEGIN
HTP.CENTEROPEN;
HTP.IMG(url => '/img/tibero.gif');
HTP.CENTERCLOSE;
END;
This example generates the following HTML code.
<CENTER>
<IMG src="/img/tibero.glf">
</CENTER>
Generates the </FONT> tag. Attributes specified inside the <FONT> tag are only applied to the contents that comes before the </FONT> tag.
Details about the FONTCLOSE procedure are as follows:
Prototype
HTP.FONTCLOSE
Example
BEGIN HTP.FONTCLOSE; END;
This example generates the following HTML code.
</FONT>
Generates the <FONT> tag for specifying font details for text.
Details about the FONTOPEN procedure are as follows:
Prototype
HTP.FONTOPEN ( color IN VARCHAR2 DEFAULT NULL, face IN VARCHAR2 DEFAULT NULL, size IN VARCHAR2 DEFAULT NULL, attributes IN VARCHAR2 DEFAULT NULL )
Parameter
Parameter | Description |
---|---|
color | COLOR attribute value. |
face | FACE attribute value. |
size | SIZE attribute value. |
attributes | Other attribute-value pairs. |
Example
BEGIN HTP.FONTOPEN(NULL, 'Fixedsys', 3); END;
This example generates the following HTML code.
<FONT face="Fixedsys" size="3">
Generates the </SELECT> tag.
Details about the FORMSELECTCLOSE procedure are as follows:
Prototype
HTP.FORMSELECTCLOSE
Example
Refer to the example in “50.3.10. FORMSELECTOPEN”.
Generates the <SELECT> tag.
Details about the FORMSELECTOPEN procedure are as follows:
Prototype
HTP.FORMSELECTOPEN ( cname IN VARCHAR2, cprompt IN VARCHAR2 DEFAULT NULL, nsize IN VARCHAR2 DEFAULT NULL, cattributes IN VARCHAR2 DEFAULT NULL )
Parameter
Parameter | Description |
---|---|
cprompt | Text that precedes the tag. |
cname | NAME attribute value. |
nsize | SIZE attribute value. |
cattributes | Other attribute-value pairs. |
Example
BEGIN HTP.FORMSELECTOPEN('favorite_fruit', 'What's your favorite fruit?'); HTP.FORMSELECTOPTION('apple'); HTP.FORMSELECTOPTION('grape'); HTP.FORMSELECTOPTION('tangerine'); HTP.FORMSELECTOPTION('plum'); HTP.FORMSELECTCLOSE; END;
This example generates the following HTML code.
What's your favorite fruit?: <SELECT NAME="favorite_fluit"> <OPTION>apple <OPTION>grape <OPTION>tangerine <OPTION>plum </SELECT>
Generates the <OPTION> tag.
Details about the FORMSELECTOPTION procedure are as follows:
Prototype
HTP.FORMSELECTOPTION ( cvalue IN VARCHAR2, cselected IN VARCHAR2 DEFAULT NULL, cattributes IN VARCHAR2 DEFAULT NULL )
Parameter
Parameter | Description |
---|---|
cvalue | Text to select. |
cselected | SELECTED attribute value. |
cattributes | Other attribute-value pairs. |
Example
Refer to the example in “50.3.10. FORMSELECTOPEN”.
Gets a web page output.
Details about the GET_PAGE procedure are as follows:
Prototype
HTP.GET_PAGE ( page OUT NOCOPY CLOB )
Parameter
Parameter | Description |
---|---|
page | Used to get the web page output. |
Example
DECLARE page CLOB; BEGIN HTP.HTMLOPEN; HTP.HTMLCLOSE; htp.get_page(page); dbms_output.put_line(page); END;
Generates the </HEAD> tag that indicates the end of the head in an HTML document.
Details about the HEADCLOSE procedure are as follows:
Prototype
HTP.HEADCLOSE
Example
BEGIN HTP.HEADCLOSE; END;
This example generates the following HTML code.
</HEAD>
Generates the tag that starts the header (<H1> - <H6>), the header text, and the closing header tag (</H1> - </H6>).
Details about the HEADER procedure are as follows:
Prototype
HTP.HEADER ( level IN PLS_INTEGER, name IN VARCHAR2, align IN VARCHAR2 DEFAULT NULL, nowrap IN VARCHAR2 DEFAULT NULL, clear IN VARCHAR2 DEFAULT NULL, attributes IN VARCHAR2 DEFAULT NULL )
Parameter
Parameter | Description |
---|---|
level | Header level. A number from 1 to 6. |
name | Header text. |
align | ALIGN attribute value. |
nowrap | NOWRAP attribute value. |
clear | CLEAR attribute value. |
attributes | Other attribute-value pairs. |
Example
BEGIN
HTP.HEADER(1, 'Tibero');
END;
This example generates the following HTML code.
<H1>Tibero</H1>
Generates the <HEAD> tag that indicates the start of the head in an HTML document.
Details about the HEADOPEN procedure are as follows:
Prototype
HTP.HEADOPEN
Example
BEGIN HTP.HEADOPEN; END;
This example generates the following HTML code.
<HEAD>
Generates the <HR> tag that draws a horizontal line in an HTML page.
Details about the HR procedure are as follows:
Prototype
HTP.HR ( clear IN VARCHAR2 DEFAULT NULL, src IN VARCHAR2 DEFAULT NULL, attributes IN VARCHAR2 DEFAULT NULL )
Parameter
Parameter | Description |
---|---|
clear | CLEAR attribute value. |
src | SRC attribute value that specifies a background image file for the horizontal line. |
attributes | Other attribute-value pairs. |
Example
BEGIN
HTP.HR(src => '"/img/tibero.jpg"',
attributes => 'size="10" noshade style="color:gray;"');
END;
This example generates the following HTML code.
<HR src="/img/tibero.jpg" size="10" noshade style="color:gray;">
Generates the </HTML> tag that indicates the end of the HTML document.
Details about the HTMLCLOSE procedure are as follows:
Prototype
HTP.HTMLCLOSE
Example
BEGIN HTP.HTMLCLOSE; END;
This example generates the following HTML code.
</HTML>
Generates the <HTML> tag that indicates the start of the HTML document.
Details about the HTMLOPEN procedure are as follows:
Prototype
HTP.HTMLOPEN
Example
BEGIN HTP.HTMLOPEN; END;
This example generates the following HTML code.
<HTML>
Generates the <IMG> tag, which inserts an image in the HTML page.
Details about the IMG procedure are as follows:
Prototype
HTP.IMG ( url IN VARCHAR2, align IN VARCHAR2 DEFAULT NULL, alt IN VARCHAR2 DEFAULT NULL, ismap IN VARCHAR2 DEFAULT NULL, attributes IN VARCHAR2 DEFAULT NULL )
Parameter
Parameter | Description |
---|---|
url | URL attribute value that specifies an image file. |
align | ALIGN attribute value. |
alt | ALT attribute value that specifies the text that is displayed when the web browser does not support images. |
ismap | Non-NULL value specifies the ISMAP attribute value that indicates whether the image is an image map. |
attributes | Other attribute-value pairs. |
Example
BEGIN
HTP.IMG(url => '"/img/tibero.gif"',
attributes => 'WIDTH="200" HEIGHT="200" BORDER="1"');
END;
This example generates the following HTML code.
<IMG src="/img/tibero.gif" WIDTH="200" HEIGHT="200" BORDER="1">
Generates the <IMG> tag that inserts an image in the HTML page. Its only difference from the IMG procedure is that the IMG2 procedure has the usemap parameter.
Details about the IMG2 procedure are as follows:
Prototype
HTP.IMG ( url IN VARCHAR2, align IN VARCHAR2 DEFAULT NULL, alt IN VARCHAR2 DEFAULT NULL, ismap IN VARCHAR2 DEFAULT NULL, usemap IN VARCHAR2 DEFAULT NULL, attributes IN VARCHAR2 DEFAULT NULL )
Parameter
Parameter | Description |
---|---|
url | SRC attribute value that specifies an image file. |
align | ALIGN attribute value. |
alt | ALT attribute value that specifies the text that is displayed when the Web browser does not support images. |
ismap | Non-NULL value specifies the ISMAP attribute value that indicates whether the image is an image map. |
usemap | USEMAP attribute value. |
attributes | Other attribute-value pairs. |
Example
BEGIN
HTP.IMG2(url => '"/img/tibero.gif"',
attributes => 'WIDTH="200" HEIGHT="200" BORDER="1"');
END;
This example generates the following HTML code.
<IMG src="/img/tibero.gif" WIDTH="200" HEIGHT="200" BORDER="1">
Generates the <HR> tag that draws a horizontal line on an HTML page. This has the same functionality as the HR procedure.
Details about the LINE procedure are as follows:
Prototype
HTP.LINE ( clear IN VARCHAR2 DEFAULT NULL, src IN VARCHAR2 DEFAULT NULL, attributes IN VARCHAR2 DEFAULT NULL )
Parameter
Parameter | Description |
---|---|
clear | CLEAR attribute value. |
src | SRC attribute value that specifies a background image file for the horizontal line. |
attributes | Other attribute-value pairs. |
Example
BEGIN
HTP.LINE(src => '"/img/tibero.jpg"',
attributes => 'size="10" noshade style="color:gray;"');
END;
This example generates the following HTML code.
<HR src="/img/tibero.jpg" size="10" noshade style="color:gray;">
Appends input string and a newline character to the current HTML source code. This represents a new line in the HTML source code. To add a new line to the actual web page, the <br> tag must be used.
Details about the PRINT procedure are as follows:
Prototype
HTP.PRINT ( str IN VARCHAR2 DEFAULT NULL )
Parameter
Parameter | Description |
---|---|
str | Text to append to the HTML source code. |
Example
BEGIN HTP.PRINT('<html>'); HTP.PRINT('<head>'); HTP.PRINT('</head>'); HTP.PRINT('<body>'); HTP.PRINT('He'); HTP.PRINT('llo'); HTP.PRINT('</body>'); HTP.PRINT('</html>'); END;
This example generates the following HTML code.
<html> <head> </head> <body> He llo </body> </html>
Appends input string to the current HTML source code. Unlike the PRINT procedure, a newline character is not appended.
Details about the PRN procedure are as follows:
Prototype
HTP.PRN ( str IN VARCHAR2 DEFAULT NULL )
Parameter
Parameter | Description |
---|---|
str | String to append to the HTML source code. |
Example
BEGIN HTP.PRN('<html>'); HTP.PRN('<head>'); HTP.PRN('</head>'); HTP.PRN('<body>'); HTP.PRN('He'); HTP.PRN('llo'); -- Added just after 'He' to make 'Hello' in the generated HTML source code. HTP.PRN('</html>'); END;
This example generates the following HTML code.
<html><head></head><body>Hello</body></html>
Generates the <TITLE> tag, a title text, and the </TITLE> tag. The <TITLE> tag specifies the text to displayed in the title header of the web browser.
Details about the TITLE procedure are as follows:
Prototype
HTP.TITLE ( title IN VARCHAR2 )
Parameter
Parameter | Description |
---|---|
title | Title text |
Example
BEGIN
HTP.TITLE('Tibero');
END;
This example generates the following HTML code.
<TITLE>Tibero</TITLE>