Adobe 38040334 - Dreamweaver CS3 User Manual page 600

Pc
Hide thumbs Also See for 38040334 - Dreamweaver CS3:
Table of Contents

Advertisement

Effectively using conditional expressions
When using
,
, and
if
else
elseif
to resolve the
directives and to determine which text to include in the result. The
if
the expression as an argument. The condition expression is the same as that for JavaScript condition expressions, and
can also contain server behavior parameters. Directives such as this allow you to choose between alternative code
blocks based on the values of, or relationships between, server behavior parameters.
For example, the following JSP code comes from a Dreamweaver server behavior that uses a conditional code block:
@@rsName@@.close();
<@ if (@@callableName@@ != '') @>
@@callableName@@.execute();
@@rsName@@ = @@callableName@@.getResultSet();<@ else @>
@@rsName@@ = Statement@@rsName@@.executeQuery();
<@ endif @>
@@rsName@@_hasData = @@rsName@@.next();
The conditional code block starts with
According to the code, if the user enters a value for the
Parameter dialog box—in other words, if the
(@@callableName@@ != '')
@@callableName@@.execute();
@@rsName@@ = @@callableName@@.getResultSet();
Otherwise, the code block is replaced with the following statement:
@@rsName@@ = Statement@@rsName@@.executeQuery();
See also
"Repeating code blocks with the loop directive" on page 595
Positioning a code block
When you create code blocks using the Server Behavior Builder, you must specify where to insert them in the page's
HTML code.
For example, if you insert a code block above the opening
relative to other tags, scripts, and server behaviors in that section of the page's HTML code. Typical examples include
positioning a behavior either before or after any recordset queries that might also exist in the page code above the
opening
tag.
<html>
When you select a positioning option from the Insert Code pop-up menu, the options available in the Relative
Position pop-up menu change to provide relevant options for that part of the page. For example, if you select Above
The
Tag In The Insert Code pop-up menu, the positioning options available in the Relative Position pop-up
<html>
menu reflect choices relevant for that part of the page.
The following table shows the code block insert options, and the relative positioning options available for each:
directives within the
insertText
<@ if (@@callableName@@ != '') @>
@@callableName@@
@@callableName@@
—then the conditional code block is replaced with the following statements:
<html>
September 4, 2007
XML tag, the participant text is preprocessed
and
if
elseif
and ends with
parameter in the server behavior's
parameter value is not null, or
tag, you must then specify the code block's position
DREAMWEAVER CS3
593
User Guide
directives take
.
<@ endif @>

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dreamweaver cs3

Table of Contents