What is the difference between JSP expression language and scriptlets? 1 Answer(s) 4 years and 8 months ago
Posted in : JSP-Servlet
September 24, 2008 at 12:37 PM
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.