Monday, 3 December 2012

Declaration Tag In JSP



Declaring Variables:
Declare  an Integer - int variablename;
Declare a String  - String variablename;

<html>
<head>
<title> Simple JSP page </title>
</head>
<body>
<h3>Using the Declaration tag declare page level variables: </h3>
<p>
<%!
int year;
%>
<p>
<b>Notes:</b>The Declaration tag does not produce any output.
</body>
</html>
Description:
  • Type <! to open declaration tag.The <%! delimiter indicates the beginning  of the Declaration tag.
  • Type the data type keyword of the variable that needs to be declared.(can declare as integer or a String)
  • Type the name of the variable.
  • Type %> after the declaration.This will end the Declaration tag.
****************************Output***************************************

Using the Declaration tag declare page level variables:

Notes:The Declaration tag does not produce any output. 

**************************************************************************

No comments:

Post a Comment