A few words of thanks would be greatly appreciated.

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:
  • <servlet> 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 <servlet> tag

The first method for integrating Java content in an HTML page is to use the <servlet> tag.

The syntax is as follows:

<SERVLET NAME="name_of_servlet"  





<PARAM NAME="Name" VALUE="Value">  


Elements of a JSP page

A JSP page can contain four types elements (excluding the HTML code):
  • directives: comprehensive information on the page
  • statements: to declare methods and attributes
  • scriptlets: Java code that will be translated into code in the service() method
  • expressions: to easily send dynamically created string to the browser

JSP comments

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:

<!-- comments [<%= expression %>] -->
  • create a comment in the JSP code for the purpose of documentation (not visible to the client) with the following syntax:

<%-- comments --%>

Original document published on CommentcaMarche.net

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.


Published by . Latest update on by deri58.

This document, titled "Java Server Pages - Features," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).