whenever a jsp file is complied its generating a corresponding servlet class file mean it is finally the servelt processed by engine.if using this <%! %> means all declaration become class member and using <% %> mean varaibles are declared in _jspInit() method. or u can say one is local and one is class member
This will falls under jspInint() method
so it becomes local variable or a varaible in a function
<%
int foo = 0;
%>
--------
this become the class member variable
<%!
int foo = 0;
%>