1 of 7

ADVANCED JAVA PROGRAMMING

Types of Tags in JSP

Smt M.Jeevana Sujitha

Assistant Professor

Department of Computer Science and Engineering

SRKR Engineering College, Bhimavaram, A.P. - 534204

2 of 7

OBJECTIVES

The Objective of this lecture is

  • To learn about Types of tags in JSP.

3 of 7

Types of Tags in JSP

  • There are three types of tags in JSP they are
  • Scriptlet tag
  • Declarative tag
  • Expression tag

4 of 7

Types of Tags in JSP

Scriptlet tag: The Scriptlet tag allows us to write the valid java code in the jsp page.

Syntax:

<%

Any valid java code

%>

Example:

<%

out.println(“JSP is better than servlets”);

%>

5 of 7

Types of Tags in JSP

Declarative tag: The Declarative Tag is used to declare variables and methods in the jsp page.

Syntax:

<%!

variable declaration method declaration

%>

Example:

<%!

String msg="Srkr engineering";

%>

6 of 7

Types of Tags in JSP

Expression tag: The Jsp expressions are used to insert java values directly into the output.

syntax:

<%=

Expression code

%>

<%!

String msg=" Srkr engineering ";

%>

<%=msg %>

7 of 7

THANK YOU