- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are JSP declarations? In how many ways we can write JSP declarations?
A declaration declares one or more variables or methods that you can use in Java code later in the JSP file. You must declare the variable or method before you use it in the JSP file.
Following is the syntax for JSP Declarations −
<%! declaration; [ declaration; ]+ ... %>
You can write the XML equivalent of the above syntax as follows −
<jsp:declaration> code fragment </jsp:declaration>
Following is an example for JSP Declarations −
<%! int i = 0; %> <%! int a, b, c; %> <%! Circle a = new Circle(2.0); %>
- Related Articles
- How to declare an object of a class using JSP declarations?
- What are Declarations?
- What are forward declarations in C++?
- Do we need forward declarations in Java?
- Can we write code in try/catch block in JSP as well?
- Can we test XPath expression in JSP?
- What is typedef declarations in C++?
- Array Declarations in Java
- Array Declarations in C#
- What are JSP comments?
- What are JSP Directives?
- What are JSP literals?
- What are filters in JSP?
- What are cookies in JSP?
- Use Declarations in Rust Programming