By: Sathya Narayana
The following syntax allows you to declare variables and methods for the page. These are placed in the generated servlet outside the _jspService() method; in other words, variables declared here will be instance variables of the servlet. Declarations don't produce any output.
This is an example of declaring a variable:
The following code declares a variable and initializes it:
You can define a method for use on the global page like so:
Declaration tags are mainly used in conjunction with scriptlets.
Most Viewed Articles (in JSP )
Latest Articles (in JSP)
Comment on this tutorial
- Data Science
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews