Tags in JSP by R4R Team

Type of JSP tags in uses:
In this JSP section, you will learn about JSP tags, list of the tags used in Java Server Pages, declaration tag, general syntax of declaration tag, expression tag and general syntax of expression tag.

Tags are a vital concept in Java Server Pages (JSP). Below is a list of tags used in JSP.

List of the tags used in Java Server Pages:

1)Expression tag
2)Scriptlet tag
3)Declaration tag

Expression Tag in JSP:
Expression tag is used to display output of any data on the generated page. The data placed in Expression tag prints on the output stream and automatically converts data into string. The Expression tag can contain any Java expression used for printing output equivalent to out.println().Thus, an expression tag contains a scripting language expression which is evaluated, automatically converts data to a String and the outputs are displayed.

Notation of Expression tag is shown below:

<%= %>

Expression tag must begin with <%= Inside Expression tag, the user embeds any Java expression. Expression tag ends with the notation %>.

NOTE: Expression should not contain a semicolon between codes, as with Declaration tag.

General syntax of Expression Tag:

<%! //start of declaration tag

statement //Java Expression

%> //end of declaration tag

For example:


Exfdate: <%= new java.util.Date() %>


Leave a Comment:
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!