Monday, 3 December 2012

Declaration Tag In JSP



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

  1. <html>
  2. <head>
  3. <title> Simple JSP page </title>
  4. </head>
  5. <body>
  6. <h3>Using the Declaration tag declare page level variables: </h3>
  7. <p>
  8. <%!
  9. int year;
  10. %>
  11. <p>
  12. <b>Notes:</b>The Declaration tag does not produce any output.
  13. </body>
  14. </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