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



Home Answers Viewqa JSP-Servlet What is the difference between JSP expression language and scriptlets?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Ashima
What is the difference between JSP expression language and scriptlets?
1 Answer(s)      6 years and 3 months ago
Posted in : JSP-Servlet



Advertisement
View Answers

September 24, 2008 at 12:37 PM


Hi friend,

Expressions :
The results of evaluating the expression are converted to a string and directly included within the output page.
They are used to display simple values of variables or return values by invoking a bean's getter methods.
They begin within <%= ... %> tags and do not include semicolons:

Scriptlet can contain any number of language statements, variable or method declarations,or expressions that are valid in the page scripting language.
In scriplets declare variables or methods to use later in the file, write expressions valid in the page scripting language,
implicit objects or any object declared.


Scriptlets are used to write the code in any language but that language is mentioned in page language attribute.

ex:<% System.out.println("Hello World "); %>

expession are used to display the simple values and returning values.

ex:

<%! public String getName(){

return "Hello World";

} %>

< %=getName(); %>

For read more information :
http://www.roseindia.net/jsp/

Thanks


Related Tutorials/Questions & Answers:
Advertisements
Advertisements
 

 

 

DMCA.com