What are Scriptlets?
A scriptlet is a valid code in java and is placed in the jspService() method of the JSP engine at the time of running. The scriptlet syntax is -
<% java code %>
There are variables available exclusively for the scriptlets. They are request, response, out,session and pageContext, application, config and exception.
What is Scriptlet tag?
Scriptlet tag is a type tag used for inserting Java Code into JSP and it is written as follows:
<% %>
The Scriptlet tag begins with <% and ends with %>. Between these the user can add any valid Scriptlet i.e. any valid Java Code.
What is Scriptlet tag? Explain with an example.
The scriptlet tag is used to write java class statements inside the jspService() method. In other words, writing java code in a Java Server Page is done through scriptlet tag. A scriptlet tag starts with <% and ends with %>.
Example:
<% int productQty = 2719;
out.println(productQty); %>