|
|
Conditional Operator in JSP Expression Language
|
Tutorials

Jsp

|
Topic |
What is a Conditional Operator in JSP Expression Language?
|
|
Explanation |
|
Conditional Operator is just same as the ternary operator that take three operands, first the
"condition" based on which it provides any one of the two results "result1" or "result2".
Syntax:
Condition? Result1, Result2
In the above syntax if the "Condition" is true, then "Result1" is returned, other wise "Result2" is returned.
Example:
<p>Conditional Operator</p>
The result of 10>2 is: "${(10>1)?'greater':'lesser'}"
Result:
Conditional Operator
The result of 10>2 is: "greater"
In the above example we have used the conditional operator to check
whether "10>2", since true it displays the result "greater".
|
|
A Note |
|
JSP(Java Server Pages) is one of the most used Server Side Programming Language in the world. Simple introduction, basic program codes with examples. Begin coding your own JSP scripts with this online tutorial. Hope you enjoy this tutorial. Do send your feedback or suggestions on this JavaServer Pages tutorial. This is a copyright content.
|
|
|
|