Um... pardon my ignorance, but I'm failing to see the real problem here. You
defined a function, but the JSP page's "out" variable isn't available to it;
well, uh, why don't you pass the output stream to the function and use it?

<%!
void myFunc(Writer out) {
   out.println("This will show up in your page now. AMAZING.");
}
%>

This isn't rocket science; just Java.


>From: Bhushan_Bhangale <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
>reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: how to use global variable?
>Date: Mon, 13 May 2002 10:36:15 +0530
>
>By defining the variable like this
>
><%!
>//declare global variable here
>%>
>
>-----Original Message-----
>From: [Vaishali S. Pandya] [mailto:[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




-----------------------------------------------
Joseph B. Ottinger       [EMAIL PROTECTED]
http://enigmastation.com          IT Consultant


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.

===========================================================================
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