O'Reilly logo

Web Technology: Theory and Practice by M. Srinivasan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required