![]() |
VOOZH | about |
The Scriptlet Tag in JSP is used to embed Java code directly into a JSP page. The code written inside the <% %> tag is executed on the server whenever a request is made, helping generate dynamic content. It is one of the basic scripting elements provided by JSP.
Syntax:
<%
// Java code here
%>
Example:
Output:
Value of num is: 10
Right-click on WebContent -> New -> Html File
Right-click on WebContent -> New -> JSP File
Right-click project ->Run As ->Run on Server (select Apache Tomcat). And access in Browser using given url.
http://localhost:8080/Geeks/
click submit: