Home Answers Viewqa JSP-Servlet About JSP Expression Language

 
 


santhosh
About JSP Expression Language
2 Answer(s)      5 years and 2 months ago
Posted in : JSP-Servlet

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 Pages:
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
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... support expression language methods of JSP. Expression language Literals
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
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
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
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
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
PHP Expression
PHP Expressions: In every language expression plays a vital role, in PHP whatever you write is an expression (almost anything). Anything has a value is an expression and this is the easiest way to define and understand expression
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
Extensible Stylesheet Language (XSL)
Extensible Stylesheet Language (XSL) is concerned about a family of languages: 1. XSL Transformations (XSLT) 2. XML Path Language (XPath) 3. XSL... is a language for transforming XML documents. XPath is an expression language
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 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
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 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
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
error : not an sql expression statement
error : not an sql expression statement  hii I am gettin followin error in connecting to database SQLserver 2005 in Jdeveloper,i m usin struts and jsp my pogram: import java.sql.*; public class TaskBO { public TaskBO
About jsp
About jsp  Read Excel data using JSP and update MySQL databse
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 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
JSP
access application data stored in JavaBeans components. The jsp expression...). Before JSP 2.0, we could use only a scriptlet, JSP expression, or a custom...WHAT IS EL JSP  WHAT IS EL   EL means the expression
Use of "ancestor" in XPath expression
Use of "ancestor" in XPath expression       As you learned about descendant axis in XPath expression in the previous example, this section will illustrate the use of ancestor
JSP Tags
JSP Tags In this section we will learn about the JSP tags. This section describes you about the various aspects of JSP tags such as what is JSP tag, list... this tag.   JSP Expression Tag : Expression tag in JSP is used
JSP-EL - JSP-Servlet
: --------------------------------- Result.jsp Use of Expression Language in jsp Hello..., This is running code. Use of Expression Language in jsp Hello ${vij.name... ------------------------ Read for more information about EL at: http://www.roseindia.net/jsp
Null Expression Example
Null Expression Example       In this section, you will see the example of null expression in with JPQL (Java Persistence Query Language). In this example, we
Java Programming Language
Java Programming Language Java is a programming language which was developed... Microsystems. The nucleus of the java platform is the Java programming language...) On November 13, 2006. Java Platform Java programming language is platform
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
R programming language.
R programming language.  i want to know about R-programming language. what is it? how to work on it? if possible provide me a ebook on the topic
including index in java regular expression
regular expression to merge using underscore consecutive capatalized words e.g.... from you is that is it possible using regular expression to avoid first word in the sentence so that i dont need to worry about first word starting with capital
Language Attribute In Page Directive
Language Attribute In Page Directive  How use language attribute in page directive ?   This attribute is used to denote the language used by a file. Language denotes the scripting language used in scriptlets
regular expression expalanation i need
regular expression expalanation i need  hi......... here is my code could explain it <html> <script language = "Javascript">... your regular expression. ^ shows beginning of string
EL Implicit Objects
;    EL is the JSP 2.0 Expression Language Interpreter from Apache Corporation. EL means the expression language , it makes it possible...; <html> <head> <title>JSP 2.0 Expression Language
Confuse about Quartz or Thread. - JSP-Servlet
Confuse about Quartz or Thread.  Hi, Thanx for reply. Is it make... productivity? Please help me. I am too confuse about this topic. Thanx... process. In Java Programming language, thread is a sequential path of code
JSP BASICS
provides global information about a particular JSP page and is of three types... Defines the scripting language of the JSP page extends... to include a JSP expressions in the JSP file is:   <%= expression
HQL, Hibernate Query Language
HQL - Hibernate Query Language In this tutorial on HQL we will learn how...? The HQL stands for Hibernate Query Language, which is inspired by the SQL... and it properties. The Hibernate Query Language is very powerful tool
EL and Complex Java Beans
. The jsp expression language allows a page author to access a bean using simple syntax...;    EL means the expression language , it makes..., JSP expression, or a custom tag to include server state in the jsp page output
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
which database and programming language i should choose - Framework
which database and programming language i should choose  Hi, I am... searched more about the programming languages and i found several powerful... good JSP programmer so i want to know which one i choose from ASP.NET and PHP
JSP Tutorial
and constructing of its response is described. JSP supports the expression language..., predefined JSP tags, the support of expression language. In a JSP page...JSP Tutorial In this section you will learn about the JSP. This section
Use of dot(.) operator in EL
. The jsp expression language allows a page author to access a bean using simple...;     EL means the expression language , it makes...; a scriptlet, JSP expression, or a custom tag to include server state in the jsp page
Introduction To Hibernate Query Language (HQL)
Introduction To Hibernate Query Language (HQL) In this tutorial you will learn about Hibernate Query Language. HQL is an abbreviation of Hibernate Query Language. It is a powerful query language, inspired by SQL that the Hibernate uses
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
A - Java Glossary
that is represented by a boolean expression and enables you to test your assumptions about your program. It  evaluates to true, but if the expression is not true...; Annotations Annotations in computer programming languages provide data about
EL and complex JavaBeans1
components. The jsp expression language allows a page author to access a bean using...;     EL means the expression language...; a scriptlet, JSP expression, or a custom tag to include server state
Page Directive attribute - language
the scripting language used in JSP page. By default its value is "java"... by the JSP page. Syntax : <%@page language="scripting language"...Page Directive attribute - language This section contains description
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
Hibernate Query Language
learned about Hibernate Query Language and its different kind of clauses. Lets...Hibernate Query Language      ... to Hibernate Query Language Hibernate Query Language or HQL for short
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
JSP API
2.0 Expression Language API. *javax.servlet.jsp.tagext <javax/servlet/jsp.../javadoc/index.html and read about JSP 2.2 API. Here is the description...JSP API API stands for Java Application Programming Interface. If you

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.