6.10 JSP TAGS

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:

  • Declarations
  • Directives
  • Expressions
  • Scriptlets
  • Actions

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 --%>.

6.10.1 Declarations

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, ...

Get Web Technology: Theory and Practice now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.