JSP Scripting elements
JSP scripting elements allow you to insert Java programming language statements in your JSP pages. Scripting elements are typically used to create and access objects, define methods, and manage the flow of control.
There are three types of scripting elements.
- scriptlet tag
- expression tag
- declaration tag
Jsp Scriptlet tag
Jsp scriptlet tag is used to insert java code into servlet that will be generated from jsp page.java code written inside scriptlet tag are placed into service method of JSP.we can’t declare method inside jsp scriptlet tag.
In simple word JSP Scriptlet Tag allows you to write java code inside JSP page.
Syntax of Jsp Scriptlet tag
<% java code %>
Example of Jsp Scriptlet tag html> <head> <title>My First JSP Page</title> </head> <body> <% out.println("Hello JSP"); %> </body> </html> Output: Hello JSP