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
;)

Ads









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
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
Advertisements
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 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
About jsp
About jsp  Read Excel data using JSP and update MySQL databse
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
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
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
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
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
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.  
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
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
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
Required help about the concept of JSP page reloading
Required help about the concept of JSP page reloading  Hi, We have one application with Websphere portlet Factory generated JSP as front end... insight about the problem. Thank you for your time
Required help about the concept of JSP page reloading
Required help about the concept of JSP page reloading  Hi, We have one application with Websphere portlet Factory generated JSP as front end... about the problem. Thank you for your time
How to make session control using only JSP programming language
How to make session control using only JSP programming language  Could i do Controlling session using only JSP programming language without using anylanguage
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
JSP Components
JSP Components In this section we will discuss about the elements of JSP... and methods which you can call in expression block of JSP page. Declarations... expression in JSP, you can use <%= and %> tags. Syntax - <
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
Learn about JSP CheckBox
Learn JSP CheckBox The tutorial highlight the features by whihc you will be able to know what is JSP checkbox and also how it works in creating a checkbox in JSP. Further, you can know in details about the multiple chechbox values
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
Hibernate JSP
In this section, you will learn about Hibernate with JSP using simple pagination example
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
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
JSP If statement Example
JSP If statement Example In this section with the help of example you will learn about the "If" statement in JSP. Control statement is used... a simple JSP program. Example : This example will help you to understand how to use
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
Regular expression
Regular expression  how i write a regular expression for a pattern which present in between
JSP
code inside the JSP page. You can learn about JSP at our JSP Tutorials section...JSP  Hi, What is JSP? What is the use of JSP? Thanks   Hi, JSP Stands for Java Server Pages. It is Java technology for developing web
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
Regular expression
Regular expression  I have the regular expression : var x=/(^\d+$)/ which allows only numbers. It does not accept character, decimals. However it accepts zero. I want an expression that takes numbers(no decimals)except zero
spring-expression maven dependency
Expression Language (SpEL) is a very useful library provided by Spring Framework. This is very powerful expression language that which is used for querying...spring-expression maven dependency  Hi, What is maven dependency
jsp:include action tag
jsp:include action tag In this section we will discuss about JSP "include" action tag. The jsp "include" tag is used to include...,  which inserts the file at the time when jsp page is translated
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
Hibernate Expression
In this section we will discuss Hibernate 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
JSP Include jsp
JSP Include jsp          This section illustrates you about the <jsp:include> directive in jsp. With the <jsp:include> directive, you can
The Include Directive in JSP Page
The Include Directive in JSP Page       This section illustrates you about the include directive of the JSP. You will learn about what is include and how to implement
The Page Directive in JSP Page
language: This is the attribute of the page directive of the JSP which is used... The Page Directive in JSP Page       This section illustrates you about the page directive
About Java
About Java This article is discussing about Java, which is a programming language developed by James Gosling at Sun Microsystems. Java now part of Oracle... about Java is listed below : Around 1.1 billions desktop runs Java. Every
JSP Examples
JSP Examples In this section we will discuss about the examples of JSP... is created and run.   JSP Scriptlet : In this tutorial you will learn about... in JSP.   JSP Declaration : In this tutorial you will learn about
jsp
jsp  Hi I don know any frame works...I am tryin to create a page in jsp which should get translated to Indian languages like kannada , telugu etc..when user selects a language can u help me out.. thanks
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
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
Lambda Expression in Java 8
Lambda Expression in Java 8: Learn the power of Lambda Expression In this section we will learn about the Lambda Expression which is introduced in the Java.... In this tutorial you will learn about the Lambda Expression in JDK 8. What is Lambda
JSP Elements
JSP Elements In this section we will learn about the JSP elements that we can... they can declare.   JSP Expression element/tag : Then expression tag.... The expression is used like the 'out' implicit object in JSP. JSP
session in jsp
session in jsp In this section you will learn about session in JSP. Here you will learn about how to use the HttpSession in JSP. session in JSP is defined... object in the JSP page. This example explains you how the session object invokes

Ads