What is difference between scriptlet and expression ?

Scriptlet: JSP allows you to write blocks of Java code inside the JSP. You do this by placing your Java code between <% and %> characters.This block of code is known as a "scriptlet". A scriptlet contains Java code that is executed every time the JSP is invoked.

Expression: JSP expressions are a quick way to insert data into an HTML page.In JSP,instead of coming up with a mathimatical value, the result of an expression is converted to a string it can be displayed as part of an HTML Page.
An expression is enclosed in these tages: <%= %> For example, To add 2+2 and display the result, you would enter the following:
<%= 2+2 %>


Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email