<%!
//java codes
%>
JSP Declaratives begins with <%! and ends %> with .We can embed any amount of java code in the JSP Declaratives. Variables and functions defined in the declaratives are class level and can be used anywhere in the JSP page.
Example:
| <%@page
contentType="text/html" %>
<html> <body> <%! <p>Values of Cnt are:</p> <p><%=getCount()%></p> <p><%=getCount()%></p> <p><%=getCount()%></p> <p><%=getCount()%></p> <p><%=getCount()%></p> <p><%=getCount()%></p> </body> </html> |
The above example prints the value of variable cnt.
To execute the code click below.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: INTRODUCTION TO JSP DECLARATIVES View All Comments
Post your Comment