just declare these varibales within the tag <% %>
say after your head tag.

Regards

Ramesh Kesavanarayanan
[EMAIL PROTECTED]
> -----Original Message-----
> From: [Vaishali S. Pandya] [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, May 13, 2002 10:12 AM
> To:   [EMAIL PROTECTED]
> Subject:      how to use global variable?
>
> hello all
> good morning
> as my prev que,
> i tried to use function and not able to use out.println in function
> so now i want to use a global array and want to add all values in array
> and
> will print that array in main code
> but i don't know how to make an array global.
>
> see the code
>
> <HTML>
> <HEAD>
> <TITLE> Factorial </TITLE>
> </HEAD>
> <BODY>
> <%!
>      public static int fact(int i){
> //        System.out.println(i);
>           myval[v++] = i;
>           if (i==1){
>                return i;
>           }
>           return i*fact(i-1);
>      }
> %>
> <%
>      for(a=0;a<v;a++)
>           out.println(myval[a]);
>      out.println(fact(5));
> %>
> </BODY>
> </HTML>
>
> here array myval and int v must be global so i can use it in main code as
> well as in function
> how?
>
> ThankX
> Vaishali
> Reliance Ind Ltd
> Ahmedabad
>
> ==========================================================================
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to