Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet About JSP Expression Language

Have Programming Question? Ask it here!
 
 
 


santhosh
About JSP Expression Language
2 Answer(s)      6 years and 4 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


Advertisement
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
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
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 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
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
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
About jsp
About jsp  Read Excel data using JSP and update MySQL databse
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
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 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
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
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
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
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
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
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 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 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
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
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
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
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
Regular expression
Regular expression  how i write a regular expression for a pattern which present in between
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
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
Hibernate Expression
In this section we will discuss Hibernate 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
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
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
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
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
A regular expression contains another regular expression - PHP
A regular expression contains another regular expression   Please explain how it works in PHP... RegEX1 = "a.*b"; RegEx2 = "a1.*b"; Thanks
regular expression for special characters
regular expression for special characters  How to find out regular expression for special characters
arithmetic expression tree
arithmetic expression tree  how to create the java code randomly for arithmetic expression tree
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
javascript regular expression
javascript regular expression  i need a regular expression code for JavaScript
Cron Expression for Cron Triggers
Cron Expression for Cron Triggers  Need a cron expression that should trigger after or before n days(will be changing) of first saturday of every month
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 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
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
regular expression for phone number
regular expression for phone number  Hi, i need the regular expression code for phone number in PHP. Thanks.   PHP - regular expression code for phone number \+?([0-9]{2})-?([0-9]{3})-?([0-9]{6,7
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
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
 

 

 

DMCA.com