Method  declaration

Method  declaration: method declaration via a declarations becomes method of the servlet  class into which  the JSP page is compiled .for example ,the following declaration defines a method for computing factorials:

<% ! public long fact (long x)

{

if(x==0 )return 1;

else

return x*fact(x-1);

}

%>

 

Declaration method can be accessed by all scripting elements on the page, regardless of the order in which the method declaration occurs relative to other scripting elements .in addition ,multiple method definition can appear within a single declaration tag, like combination of both variable and method declaration

Leave a Reply

Your email address will not be published. Required fields are marked *