The reader can observe the syntax of JSP which is just like any other web framework like ruby on rails or ASP.NET. In short, barring Comments, the JSP syntax can be considered to fall into the following types:
Each of these types are differentiated in the representation by means of tags. The code, consisting of a line or a group of lines, is embedded within each pair of tags (just similar to any HTML). For example a comment is embedded between <%-- and --%>.
Declarations are used to define variables, when the page is loaded. It internally declares them in the servlet class that is generated.
<%! String msg=null; %>
The above statement declares a variable, ...