Scriptlet Tag
Scriptlet tags are the easiest way to put java code in a JSP page. A scriptlet tag starts with <% and ends with %>.
Any code written inside the scriptlet tags go into the _jspService() method.JSP Scriplet contains a valid set of scripting code that can be used in a JSP page.
Syntax:
<%
scripting-language-statements
%>
Based on the scripting language the code is transformed into that language. If the scripting language is set to java, the code is inserted as JSP Page servlet. The main advantage of JSP Scriptlets is that it can be accessed from anywhere within the JSP page. The jsp scriptlet tag can only declare variables not methods.
Following code snippet tells the working of scriptlet tag: