Easy learning with example program codes

JSP Declaration tag

Declaration tag is used to declare one or more variables or methods at class level. Variables and methods declare in declaration tag are initialized at the time of JSP initialization. These variables and methods are kept outside of the service method by web container to make them class level.

Syntax: <%!  Variable or method Declaration %>



		<title>Declaration tag example</title>
			int sum(int a, int b){
			return a + b;
			out.println("Sum of 10 and 20 = " + sum(10, 20));




jsp example 3
Download this example.
Next Topic: JSP Expression tag with example.
Previous Topic: JSP Scriptlet tag with example.

Related Topics:

How to build java project using ant in eclipse?
JAXB marshalling – convert java object to xml example.
How to create pdf file in java using iText jar?
Generics class example.
OGNL in struts 2.
Hibernate One-to-One Mapping using xml.
Send inline image in email using JavaMail API.
Quartz 2 JobListener example.


Sign Up/ Sign In
Ask a Question

Copyright © 2018 CodesJava Protection Status SiteMap Reference: Java Wiki