About JSP Expression Language

About JSP Expression Language

Hi i am new to JSP i am now going through the basics of JSP..on the process i tried a simple JSp program... pls help me... Addition of Two Numbers JSP

View Answers

April 2, 2008 at 8:04 PM

Addition of Two Numbers JSP

Hi! Nice problem but you do not need to worry as you have made a very small mistake!
In your code you have defined the function in static format and anything, which is written in static, will print the value as it is given.

In your code you have written ?2 + 2 is $ {2 + 2}? in a body, so there is no chance of getting calculated value from it.

In JSP programming you can retrieve the value through Scriptlets <% %>.

Your program of Addition of two values in JSP would be as fellow:

JSP addition of two Numbers - Example Code

- - - - - - - - - - - - - - - - - - - - - - -
<%@ page language="java" import="java.util.*" %>
<html>
<head>
</head>
<body>
<h1>Hello World!</h1>
<%!
int i = 45;
int j = 30;
int Sum;
%>
<%
Sum = i + j;

out.println("The sum of " + i + " and " + j + " is =" + Sum); %>
</body>
</html>
- - - - - - - - - - - - - - - - - - - - - - -
You must be feeling much better now.... i guess

April 2, 2008 at 8:11 PM

Run the above given answer and i'm sure it'll work for you. if you want to go into deep of JSP Scriptlets just read the JSP Scriplet Tutorials here

http://www.roseindia.net/jsp/jspscriptlets.shtml

neelam
;)









Related Tutorials/Questions & Answers:
About JSP Expression Language - JSP-Servlet
About JSP Expression Language   Hi i am new to JSP i am now going through the basics of JSP..on the process i tried a simple JSp program... pls help me... Addition of Two Numbers JSP   Addition of Two Numbers JSPHi
What is the difference between JSP expression language and scriptlets? - JSP-Servlet
What is the difference between JSP expression language and scriptlets?  Hi, I just want to ask what is the difference between JSP Expression Langauge and JSP scriptlets? Pls help me.   Hi friend
Advertisements
Expression Language in JSP
Expression Language in JSP      ... application data stored in JavaBeans components. The jsp expression language allows... to include server state in the jsp page output. Expression Language (EL
JSF Expression Language(EL)
Expression Language(EL) In this section, you will get a brief description about Expression Language of JSF. Expression Language is used to access... don't support expression language methods of JSP. Expression
Expression Language execution in notepad
Expression Language execution in notepad  how to execute expression language in notepad for java i am using apache tomcat server4.0.
expression language array
expression language array  var test='${abc.myarray}'; //myarray is string array in bean //abc How to get the length of myarray? I tried test.length which does not work
Expression Language Basic Arithmetic
components. The jsp expression language allows a page author to access a bean using...Expression Language Basic Arithmetic          EL means the expression language
ModuleNotFoundError: No module named 'xcover-expression-language'
ModuleNotFoundError: No module named 'xcover-expression-language'  Hi...: No module named 'xcover-expression-language' How to remove the ModuleNotFoundError: No module named 'xcover-expression-language' error? Thanks
Language' attribute of JSP page directive
'Language' attribute of JSP page directive In this Section , we will discuss about the "language" attribute of a JSP page & its use in JSP page. A directive element in a JSP page provides global information about
cron expression - JSP-Servlet
cron expression  Hi, I need to create cron expression dynamically in java when the user gives the specifications like frequency, delay, daily , monthly etc.. from a jsp page. Please help me out ASAP. Regards, Pavani
About jsp
About jsp  Read Excel data using JSP and update MySQL databse
about a program in c language
about a program in c language   Write a program that inputs five different integers from the keyboard, then print the sum, the product, the smallest and the largest of these numbers. Use only single selection form of if statement
About Jsp
About Jsp  Hello sir, I am developing online Quiz project in jsp using MySql Database. I want to know that How I will show Questions from database One by One on Same page and also want to calculate Result for the User
about regular expression - Java Beginners
about regular expression  Consider the grammar G: S -> ( L ) | a L -> L, S | S a) Eliminate the left-recursion from grammar G. b) Construct a recursive descent parser for G
Maven Repository/Dependency: org.apache.nifi | nifi-expression-language
Maven Repository/Dependency of Group ID org.apache.nifi and Artifact ID nifi-expression-language. Latest version of org.apache.nifi:nifi-expression-language dependencies. # Version Release Date
Is JSP a client side scripting language?
Is JSP a client side scripting language?  Is Java Server Pages(JSP) is a client side language or server side scripting language? Also what is JSF
About jsp and Servlet - JSP-Servlet
About jsp and Servlet  Servlets are directly using java technologies. It is used in HTTP,FTP..etc, But Jsp only used in HTTP. Servlets are running fastly... Then why we moved from Servlet to JSP.. Pl Tell me the reasons
Question about JSP - JSP-Servlet
Question about JSP  Please tell me how to retrieve an image from SQL Server 2000 using JSP code.I know how to store the image as it stores in binary format. But i don't know hoe to retrieve
about hashmap - JSP-Servlet
about hashmap  hi.. i want suggestion in hashmap handling. in my program i have to pass parameters from different jsp pages and ve to store it. i ve used vector but its not recommended . thanks in advance
about jsb - JSP-Servlet
about jsb  after doing project using jsb iwant public to see it from my device (as server) what i do? need help   Hi friend...://www.roseindia.net/jsp/ Thanks
Redirecting the output of an expression to a variable - JSP-Servlet
Redirecting the output of an expression to a variable  I want to redirect the output of to a variable defined in variable.jsp. What is the syntax...' file: Create another jsp file 'get.jsp' to get the output: Thanks
About MVC 2 architecture and jsp - JSP-Servlet
to the client request.But JSP is a scripting language flexible for web designers...About MVC 2 architecture and jsp  Sir, I want to know about MVC 2... is the need of servlets when jsp can perform all functionalities .  Hi
Is JSP a client side scripting language?
Is JSP a client side scripting language?  Is JSP and servlet client side scripting language?   Server-side scripting is executed by a web... in a language that's compatible with, or compiled to communicate with, the browser.  
Is JSP a client side scripting language?
Is JSP a client side scripting language?  Is JSP and servlet client side scripting language?   Server-side scripting is executed by a web... in a language that's compatible with, or compiled to communicate with, the browser.  
Is JSP a client side scripting language?
Is JSP a client side scripting language?  Is JSP and servlet client side scripting language?   Server-side scripting is executed by a web... in a language that's compatible with, or compiled to communicate with, the browser.  
Is JSP a client side scripting language?
Is JSP a client side scripting language?  Is JSP and servlet client side scripting language?   Server-side scripting is executed by a web... in a language that's compatible with, or compiled to communicate with, the browser.  
Display "Hello JSP" using Jsp expression
Display "Hello JSP"  using Jsp expression In this section, We will simply output "Hello JSP"  in a web browser using Jsp expression. JSP expressions insert values directly into the output. The syntax
about player - JSP-Servlet
about player  hi i have a website in which, i want to play some video& audio files using jsp.so ,how to call the realplayer on to my website and play some video. if the user doesnot have a player , it should automatically
Maven dependency for org.apache.nifi - nifi-expression-language version 1.19.0 is released. Learn to use nifi-expression-language version 1.19.0 in Maven based Java projects
-expression-language released The developers of   org.apache.nifi - nifi-expression-language project have released the latest version of this library... - nifi-expression-language version 1.19.0 ) in their Java project if it is based
Maven dependency for org.apache.nifi - nifi-expression-language version 1.19.0 is released. Learn to use nifi-expression-language version 1.19.0 in Maven based Java projects
-expression-language released The developers of   org.apache.nifi - nifi-expression-language project have released the latest version of this library... - nifi-expression-language version 1.19.0 ) in their Java project if it is based
Maven dependency for org.apache.nifi - nifi-expression-language version 1.19.1 is released. Learn to use nifi-expression-language version 1.19.1 in Maven based Java projects
-expression-language released The developers of   org.apache.nifi - nifi-expression-language project have released the latest version of this library... - nifi-expression-language version 1.19.1 ) in their Java project if it is based
Maven dependency for org.apache.nifi - nifi-expression-language version 1.19.1 is released. Learn to use nifi-expression-language version 1.19.1 in Maven based Java projects
-expression-language released The developers of   org.apache.nifi - nifi-expression-language project have released the latest version of this library... - nifi-expression-language version 1.19.1 ) in their Java project if it is based
Maven dependency for org.apache.nifi - nifi-expression-language version 1.18.0 is released. Learn to use nifi-expression-language version 1.18.0 in Maven based Java projects
-expression-language released The developers of   org.apache.nifi - nifi-expression-language project have released the latest version of this library... - nifi-expression-language version 1.18.0 ) in their Java project if it is based
Maven dependency for org.apache.nifi - nifi-expression-language version 1.16.3 is released. Learn to use nifi-expression-language version 1.16.3 in Maven based Java projects
-expression-language released The developers of   org.apache.nifi - nifi-expression-language project have released the latest version of this library... - nifi-expression-language version 1.16.3 ) in their Java project if it is based
Maven dependency for org.apache.nifi - nifi-expression-language version 1.17.0 is released. Learn to use nifi-expression-language version 1.17.0 in Maven based Java projects
-expression-language released The developers of   org.apache.nifi - nifi-expression-language project have released the latest version of this library... - nifi-expression-language version 1.17.0 ) in their Java project if it is based
Maven dependency for org.apache.nifi - nifi-expression-language version 1.16.2 is released. Learn to use nifi-expression-language version 1.16.2 in Maven based Java projects
-expression-language released The developers of   org.apache.nifi - nifi-expression-language project have released the latest version of this library... - nifi-expression-language version 1.16.2 ) in their Java project if it is based
Maven dependency for org.apache.nifi - nifi-expression-language version 1.16.1 is released. Learn to use nifi-expression-language version 1.16.1 in Maven based Java projects
-expression-language released The developers of   org.apache.nifi - nifi-expression-language project have released the latest version of this library... - nifi-expression-language version 1.16.1 ) in their Java project if it is based
Maven dependency for org.apache.nifi - nifi-expression-language version 1.16.0 is released. Learn to use nifi-expression-language version 1.16.0 in Maven based Java projects
-expression-language released The developers of   org.apache.nifi - nifi-expression-language project have released the latest version of this library... - nifi-expression-language version 1.16.0 ) in their Java project if it is based
Maven dependency for org.apache.nifi - nifi-expression-language version 1.15.3 is released. Learn to use nifi-expression-language version 1.15.3 in Maven based Java projects
-expression-language released The developers of   org.apache.nifi - nifi-expression-language project have released the latest version of this library... - nifi-expression-language version 1.15.3 ) in their Java project if it is based
Maven dependency for org.apache.nifi - nifi-expression-language version 1.15.2 is released. Learn to use nifi-expression-language version 1.15.2 in Maven based Java projects
-expression-language released The developers of   org.apache.nifi - nifi-expression-language project have released the latest version of this library... - nifi-expression-language version 1.15.2 ) in their Java project if it is based
Maven dependency for org.apache.nifi - nifi-expression-language version 1.15.1 is released. Learn to use nifi-expression-language version 1.15.1 in Maven based Java projects
-expression-language released The developers of   org.apache.nifi - nifi-expression-language project have released the latest version of this library... - nifi-expression-language version 1.15.1 ) in their Java project if it is based
Maven dependency for org.apache.nifi - nifi-expression-language version 1.15.0 is released. Learn to use nifi-expression-language version 1.15.0 in Maven based Java projects
-expression-language released The developers of   org.apache.nifi - nifi-expression-language project have released the latest version of this library... - nifi-expression-language version 1.15.0 ) in their Java project if it is based
Maven dependency for org.apache.nifi - nifi-expression-language version 1.14.0 is released. Learn to use nifi-expression-language version 1.14.0 in Maven based Java projects
-expression-language released The developers of   org.apache.nifi - nifi-expression-language project have released the latest version of this library... - nifi-expression-language version 1.14.0 ) in their Java project if it is based
Maven dependency for org.apache.nifi - nifi-expression-language version 1.13.2 is released. Learn to use nifi-expression-language version 1.13.2 in Maven based Java projects
-expression-language released The developers of   org.apache.nifi - nifi-expression-language project have released the latest version of this library... - nifi-expression-language version 1.13.2 ) in their Java project if it is based
Maven dependency for org.apache.nifi - nifi-expression-language version 1.13.1 is released. Learn to use nifi-expression-language version 1.13.1 in Maven based Java projects
-expression-language released The developers of   org.apache.nifi - nifi-expression-language project have released the latest version of this library... - nifi-expression-language version 1.13.1 ) in their Java project if it is based
Maven dependency for org.apache.nifi - nifi-expression-language version 1.13.0 is released. Learn to use nifi-expression-language version 1.13.0 in Maven based Java projects
-expression-language released The developers of   org.apache.nifi - nifi-expression-language project have released the latest version of this library... - nifi-expression-language version 1.13.0 ) in their Java project if it is based
Maven dependency for org.apache.nifi - nifi-expression-language version 1.2.0 is released. Learn to use nifi-expression-language version 1.2.0 in Maven based Java projects
-expression-language released The developers of   org.apache.nifi - nifi-expression-language project have released the latest version of this library... - nifi-expression-language version 1.2.0 ) in their Java project if it is based
Expression tag
Expression tag  Defined Expression tag in JSP ?   Expression tag is used to display output of any data on the generated page. The data... a scripting language expression which is evaluated, automatically converts data
About Java Programming Language
About Java Programming Language       Java is an Object oriented application programming language... language. Java programming language is useful for development of enterprise grade
About tld files - JSP-Interview Questions
About tld files  What are tag library descriptor files & what... files are the XML document that contains information about the whole library and about each tag contained in the library. These files are used by a web container

Ads