Literals are the values, such as a number or a text string, that are written literally as part of a program code. A literal is a expression of a value, including a number or a text string.
In this simple jsp program we are using a literals. We are printing the literals by using the out implicit object, which is used to print the content on the brower. We have provided this object implicitly by the jsp. It means that we doesn't need to create a object of the PrintWriter class.
The code of the program is given below:
<html> <head> <title>Using Literals in Jsp</title> </head> <BODY> <H1>Using a Literal in Jsp</H1>
out.println("Days of the weeks = " ); out.println(7); %> <br> <%
out.println("Number of months = "); out.println(12); %> </BODY> </html>
Output of the Program:
Liked it! Share this Tutorial