Application Integration (On-Premises) : Incorporating web applications : webMethods Tag Library for JSP : <webm:ifvar>
<webm:ifvar>
You 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 has a particular value.
You can also define a different block of code to execute if the specified condition is not met
Use <webm:then> to define the block of code to execute if the condition is met. Use <webm:else> to define the block of code to execute 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 is false if the value is null. 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 string you specify in any_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 pipeline variable you specify in ref_variable.
Example
<webm:ifvar variable="supplierInfo/state"
vequals="buyerInfo/state">
[matches="regular_exp"]
Specifies that the condition is true if the variable matches the regular expression regular_exp.
Example
In this 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, this 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>
Copyright © 2015- 2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback