Java Server Pages - Features
Implementation of JSP code in the HTML page
A JSP file is a file with the .jsp extension containing HTML and specific tags:
tags to integrate a servlet within the HTML code. JSP syntax tags (there are four different types).
Through the use of tags, JSP can easily integrate Java code within the HTML code. The main advantage of this mechanism compared to servlets, is the separation between the data (directly encoded in HTML) and the logic (process) provided by Java.
JSP can be used to access reusable components (servlets, JavaBeans, Enterprise JavaBeans (EJB)).
The
The first method for integrating Java content in an HTML page is to use the
The syntax is as follows:
Elements of a JSP page
A JSP page can contain four types elements (excluding the HTML code):
directives : comprehensive information on the page
: comprehensive information on the page statements : to declare methods and attributes
: to declare methods and attributes scriptlets : Java code that will be translated into code in the service() method
: Java code that will be translated into code in the service() method expressions: to easily send dynamically created string to the browser
With JSP you can add comments in two ways.
generate a comment visible in the HTML source code (HTML comment) of the client with the following syntax:
create a comment in the JSP code for the purpose of documentation (not visible to the client) with the following syntax:
Original document published on CommentcaMarcheet