Explain JSP declaration and scriptlet tags?
Answered
Explain JSP declaration and scriptlet tags?
Best answer
<%! … %> are JSP Declaration tags while <% … %> are JSP Scriptlet tags.
In JSP declarations – <%! code %>, the code is inserted into the body (outside of the methods) of the servlet class generated from the JSP page.
In Scriptlet – <% code %>, the code goes into the _jspService() method of the servlet generated from the JSP page. The code is visible only to the _jspService() method of the servlet class.