Application Platform 10.7 | Application Platform API | webMethods Tag Library for JSP | <webm:ifvar>
 
<webm:ifvar>
Use the <webm:ifvar> tag to execute a block of code in the JSP if a specified condition is met. The condition can be either that a certain Integration Server pipeline variable exists, or that the variable has a particular value. You can also define a different block of code to be executed if the specified condition is not met.
Use <webm:then> to define the block of code to be executed if the condition is met. Use <webm:else> to define the block of code to be executed if the condition is not met.
Syntax
<webm:ifvar variable="variable" [isNull="true"] [notEmpty="true"]
[equals="any_string"] [vequals="ref_variable"] [matches="regular_exp"]>
<webm:then>block_of_code</webm:then>
[<webm:else>block_of_code</webm:else>]</webm:ifvar>
Arguments
Argument
Description
variable
Pipeline variable to evaluate.
Example
<webm:ifvar variable="carrier">
[isNull="true"]
Specifies that the condition is true if the variable exists but its value is null.
Example
<webm:ifvar variable="carrier" isNull="true">
[notEmpty="true"]
Specifies that the condition is true if the variable contains one or more characters and false if the value of the variable is null. Use for string variables only.
Example
<webm:ifvar variable="carrier" notEmpty="true">
[equals="any_string"]
Specifies that the condition is true if the variable matches the specified string.
any_string is case sensitive. For example, FedEx does not match Fedex or FEDEX.
Example
<webm:ifvar variable="carrier" equals="FedEx">
[vequals="ref_variable"]
Specifies that the condition is true if the variable matches the value of the specified pipeline variable.
Example
<webm:ifvar variable="supplierInfo/state"
vequals="buyerInfo/state">
[matches="regular_exp"]
Specifies that the condition is true if the variable matches the specified regular expression .
Example
In the following example the condition is true if the value of the pipeline variable carrier starts with UPS:
<webm:ifvar variable="carrier" matches="UPS*">
Example
If a variable named AuthCode exists in the pipeline, the following code inserts a success message into the HTML page produced from the JSP. The success message includes the current date and the value of the pipeline variable AuthCode. If the variable does not exist, the code inserts an error message.
<webm:ifvar variable="AuthCode">
<webm:then>
<p>Authorization code received <webm:sysvar variable="date">
<webm:value variable="AuthCode"></p>
</webm:then>
<webm:else>
<p>Error: Authorization code does not exist.</p>
</webm:else>
</webm:ifvar>