Javaserver Pages





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
JSP Tutorial
Introduction Introduction
Installing JDK-Windows Installing JDK-Windows
Installing JDK-Linux Installing JDK-Linux
Installing Tomcat Installing Tomcat
Simple Program in JSP Simple Program in JSP
Pre-defined Variables Pre-defined Variables
Syntax of Tags Syntax of Tags
JSP Expression Language JSP Expression Language
JSP EL Operators JSP EL Operators
EL Implicit Variables EL Implicit Variables
Scopes Scopes
Using Arrays Using Arrays
Methods Methods
JSP Elements JSP Elements
Including Beans Including Beans
JSTL Tags JSTL Tags
Custom Tags Custom Tags
Session Session in JSP
Handling Cookies Handling Cookies
JSP Application Structure JSP Application Structure
Configuring web.xml Configuring web.xml
Tomcat Configuration Tomcat Configuration
JSP Examples JSP Examples
Forums Ask Your Doubts
Feedback Feedback
 




Relational Operator in JSP Expression Language


Tutorials Jsp

Topic

What are the Relational Operator in JSP Expression Language?



Explanation

Equality or relational operator in JSP Expression Language is used to check the values returned by two expressions or operands. Comparisons can also be done with other values like boolean, string, integer, or floating point literals.

Logic Expression Result
Equal ${10.0==10} true
Equal ${10.0 eq 10} true
Not Equal ${((20*10)!= 200)} true
Not Equal ${3 ne 3} false
Greater than or equal ${3.2>=2} true
Greater than or equal ${3.2 ge 2} true
Less than ${2<3} true
Less than ${4 lt 6} true
Less than or equal ${2 <= 4} true
Less than or equal ${4 le 2}

Example:
   <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
   <p>Relational Operator Example</p>
   <c:if test="${'Computer'!='computer'}">
	It's true that Computer is not equal to computer
   </c:if>
Result:
    Relational Operator Example
    It's true that Computer is not equal to computer

In the above example we have used a "if" statement along with relational operator "!=" to compare two strings "Computer" and "computer" which are not equal since the first letter "C" are in different cases. So its "true" the message "It's true that Computer is not equal to computer" is displayed.






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.


Other Links

web hosting