Scriptlet in JSP
How are Scriptlets used in JSP?
Explanation
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 tranformed 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. Example
<%
out.println("JSP Scriptlet");
%>
Result :
JSP Scriptlet
In the above example we have just included a JSP code to print the text "JSP Scriptlet".