Declare valid variables and methods in JSP programs
JSP syntax
<%! Declaration; [Declaration;] +... %>
Example
<%! Int I = 0; %>
<%! Int A, B, C; %>
<%! Circle A = new circle (2.0); %>
Description
Declare the variables and methods you will use in the JSP program. You must do the same. Otherwise, an error will occur.
You can declare multiple variables and methods at a time, as long as they end with ";". Of course, these declarations are valid in Java.
When declaring methods or variables, pay attention to the following rules:
The declaration must end with ";" (scriptlet has the same rule, but the expression is different ).
You can directly use declared variables and methods included in <% @ Page %> without declaring them again.
A statement is valid only on one page. If you want to use some declarations for each page, you 'd better write them into a separate file and include them with the <% @ include %> or <JSP: Include> element.