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
 




Arithmetic Operator in JSP


Tutorials Jsp

Topic

What are the JSP Expression Language Arithmetic Operator?



Explanation

Arithmetic operators are used for basic arithmetic operations like addition, subtraction, multiplication , division and modulus in JSP Expression Language.

Logic Expression Result
Addition ${2+3} 5
Addition ${2.5+3} 5.5
Addition ${3.3E4 + 2.5} 33002.5
Subraction ${-2-3} -5
Multiplication ${2*3} 6
Division ${6/2} 3
Division ${6 div 2} 3
Division ${6/0} Infinity
Modulus ${7%3} 1
Modulus ${7 mod 3} 1

Example:
   The Modulus of 7 and 3 is: "${7%3}"
Result:
    The Modulus of 7 and 3 is: "1"

In the above example we have used the "%" or the "modulus" operator to find the remainder of x and y, which has values "7" and "3". The result is 1 as the remainder after dividing "7" by "3" is 1.






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