Anatomy of a JSP Page

A JSP page basically consists of two parts: HTML/XML markups and JSP constructs. A large percent of your JSP page, in many cases, just consists of static HTML/XML components, known as template text. Consequently, we can create and maintain JSP pages using traditional HTML/XML tools.

We use three primary types of JSP constructs in a typical JSP page: scripting elements, directives, and actions.

Java code that will become an integral part of the resultant servlet is inserted using scripting elements. Directives let us control the overall structure and behaviour of the generated servlet. Actions allow us to use existing components, and otherwise control the behaviour of the JSP engine.

There are three kinds of scripting elements: scriptlets, declarations, and expressions. Scriptlets allow us to insert any Java-server-relevant API in the HTML or XML page provided that the syntax is correct. Declarations allow us to declare variable and methods. Expressions are used to print the value of Java expressions.

Source: Uttam Kumar Roy (2015), Advanced Java programming, Oxford University Press.

Leave a Reply

Your email address will not be published. Required fields are marked *