Specifications

Server Behaviors 185
In the previous example, the telephone number must be specified. However, you can make the
telephone number optional, by adding the
isOptional attribute, as shown in the following example:
<quickSearch>address</quickSearch>
<searchPatterns whereToSearch="directive">
<searchPattern paramNames="lname">/LNAME\s*=\s*"([^\r\n]*)"/i¬
</searchPattern>
<searchPattern paramNames="fname">/FNAME\s*=\s*"([^\r\n]*)"/i¬
</searchPattern>
<searchPattern paramNames="phone" isOptional="true">¬
/PHONE\s*=\s*"([^\r\n]*)"/i
</searchPattern>
</searchPatterns>
Now the participant is recognized, even if the telephone number is not found.
How participants are matched If a server behavior has more than one participant, the participants
must be identified in the users document and matched. If the user applies multiple instances of
the server behavior to a document, each group of participants must be matched accordingly. To
ensure participants are matched correctly, you might need to change or add parameters and
construct participants so they can be uniquely identified.
Matching requires some rules. Participants are matched when all parameters with the same name
have the same value. Above and below the
<html> tag, there can be only one instance of a
participant with a given set of parameter values. Within the
<html>...</html> tags, participants
are also matched by their position relative to the selection or to common nodes that are used for
insertion.
Participants without parameters are automatically matched, as shown in this example of a server
behavior with group file:
<group serverBehavior="test.htm">
<title>Test</title>
<groupParticipants>
<groupParticipant name="test_p1" partType="identifier" />
<groupParticipant name="test_p2" partType="identifier" />
</groupParticipants>
</group>
This example inserts two simple participants above the <html> tag:
<% //test_p1 %>
<% //test_p2 %>
<html>
These participants are found and matched, and Test appears once in the Server Behaviors panel.
If you add the server behavior again, nothing is added because the participants already exist.
If the participants have unique parameters, multiple instances can be inserted above the
<html>
tag. For example, by adding a name parameter to the participant, a user can enter a unique name
in the Test Server Behavior dialog box. If the user enters name
"aaa", the following participants
are inserted:
<% //test_p1 name="aaa" %>
<% //test_p2 name="aaa" %>
<html>