Oracle Web Publishing Assistant Getting Started Release 2.0 for Windows NT A55738-01 |
|
This chapter discusses how the different components of Oracle Web Publishing Assistant work together to deliver web-enabled Oracle database information.
Specific topics discussed are:
Oracle Web Publishing Assistant provides you with sample templates (located in ORANT\OWAST\SAMPLES). Use these templates to become familiar with creating web page queries.
The default template (.HTX) uses a Java applet to format the database query information into a spreadsheet-like web page. The new Java-enabled web page template:
Additional Information:
See Chapter 4, "Using the Tutorials" for more information on the available templates. |
If you want to design your own templates, use the Oracle Web Publishing Assistant keywords in the HTML extension files (.HTX) to control how the web page is constructed. The Oracle Web Publishing Assistant keywords used in the .HTX files are:
The template syntax is supported by HTML editors like Microsoft Frontpage. Templates can be modified at any time. Oracle Web Publishing Assistant uses the modified template when generating your web page at the next scheduled generation time.
If you modify your original query after generating a web page, then Oracle Web Publishing Assistant prompts you to modify your template. Oracle Web Publishing Assistant launches your default template editor. You can then choose to use the original template, modify your existing template, or use a new template. See Chapter 3, "Administering Web Page Queries" and Oracle Web Publishing Assistant Online Help for more information.
This keyword surrounds a section of the HTML extension file in which the data output from the Oracle database will be merged. Within the section, the column names are delimited with <% and %> which are used to mark the position of the data returned from the query.
For example:
<%begindetail%> <%ename%>: <%sal%> <%enddetail%>
lists the columns ENAME (employee name) and SAL (salary). You can refer to any column in this manner. You can refer to column names in other sections of the extension file. If no records are returned from the query, the <%begindetail%> section will be omitted.
Your template can contain conditional logic with an if-then-else statement to control how the web page is constructed. One common usage of an if-then-else statement is to insert a condition to display the results from the query on the first row with a <%begindetail%> section. If no records are returned by the query, the following message appears in the resulting HTML file:
Sorry, no employees had salaries greater than 5000.
By using the <%if%> statement and a built-in variable CurrentRecord, you can tailor the output so that the error message is displayed when no records are returned by the query.
The syntax is structured as:
<%if condition%> HTML text [<%else%> HTML text] <%endif%>
where condition is of the form:
value1 operator value2
and operator can be one of the following:
Operator | If... |
---|---|
EQ |
value1 equals value2 |
LT |
value1 is less than value2 |
GT |
value1 is greater than value2 |
CONTAINS |
any part of value1 contains the string value2 |
The operands value1 and value2 can be column names, a built-in variable, or a constant. See the section "Variable CurrentRecord" for more information.
Here is an example:
<HTML> <BODY> <%begindetail%> <%if CurrentRecord EQ 0 %> <B>Employee Name Salary<BR></B> <%endif%> <%ename%>:<%sal%> <%enddetail%> <P> <I> This web page was created by merging the results of the SQL query with the template file EXAMPLE2.HTX. <P> The merge was performed by Oracle Web Publishing Assistant and the results were stored in a web page. </I> </BODY> </HTML>
When used in an <%if%> statement, values are not delimited with <% and %>. For example, to process employee name Scott, use the condition:
<%begindetail%> <%if ename EQ "Scott"%> The employee is Scott. <%endif%> <%enddetail%>
The CurrentRecord variable contains the number of times the <%begindetail%> section has been processed. The first time through the <%begindetail%> section, the value is zero (0). The value of CurrentRecord changes every time another record is retrieved from the database.
The CurrentDate variable shows the date and time of the web page generation. This variable cannot be used inside <%if%> statements. If you do not specify a date format, the default format used is DD/MMM/YYYY (for example, 05/OCT/1997). The default time format is HH:MM:SS A.M./P.M. (for example, 10:01:15 A.M.). You can change the date and time format using these codes:
The # flag may prefix any formatting code, and the meaning of the format code is changed as follows:
Here is an example using the CurrentDate variable:
<%CurrentDate:Today is %A, day %d of %B in the year %Y %>
which translates into (depending upon what the actual date is when the web page is generated):
Today is Tuesday, day 8 of October in the year 1997
The MaxColumn variable <%MaxColumn%> specifies the number of columns returned by the query.
The QueryId variable <%QueryId%> provides a unique identifying number for the generated web page. You can use this number when troubleshooting Oracle Web Publishing Assistant. See Appendix B, "Troubleshooting" for more information.
Web page queries generated by Oracle Web Publishing Assistant consist of two types of information:
Information Type | Description |
---|---|
Static Information |
Stored in a template. |
Dynamic Information |
Retrieved from the database and merged with the static information from the template. |
This model of page generation has two benefits:
The template layout is compatible with popular HTML editors such as Microsoft Frontpage. You can modify the templates in any way you want, whenever you want.
The database does not need to be accessed every time a web page is viewed. The database only needs to return results from the query, therefore performance is not negatively impacted.
Oracle Web Publishing Assistant registry values are located under the key HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE.
To modify the settings of the repository values OWASTDBS and OWASTDBC:
The Edit String window appears.