Example & Tutorial understanding programming in easy ways.

what usage of Declaration Tag explain with example?.

Declaration tag is used to define functions, methods and variables that will be used in Java Server Pages(JSP).

Notation of the Declaration tag is given below:

<%! %>

At the start of Declaration tag one must place <%! Inside Declaration tag one can declare variables or methods. Declaration tag ends with the notation %>. Also care must be taken to place a semicolon that is ; at the end of each code placed inside Declaration tag.

General syntax of Declaration Tag:

<%! //start of declaration tag

statement1;

statement2; //variables or methods declaration

……….;

……….;

%> //end of declaration tag

For example:

<%!

private int example = 0 ;

private int test = 5 ; %>

Read More →