I tried your code on IPlanet 6.0 webserver and there System.out worked fine after 
setting the out stream 

System.setOut(new PrintStream(new 
FileOutputStream("D:/TreasureHunt/Code/logs/error.log")));

The out.println will not work in the declared method as the out is declared and 
initialized in the service method when the jsp gets converted to servlet. Thus the out 
won't be accessible in the declared method.

-----Original Message-----
From: [Vaishali S. Pandya] [mailto:[EMAIL PROTECTED]]
Sent: Saturday, May 11, 2002 4:00 PM
To: [EMAIL PROTECTED]
Subject: Re: can't use out.println in function


no dear
it is also not working
and as per my calique, this statment will print the line on server(tomcat)
try this
<HTML>
<HEAD>
<TITLE> Factorial </TITLE>
</HEAD>
<BODY>
<%!
     public static int fact(int i){
          System.out.println(i);
          if (i==1){
               return i;
          }
          return i*fact(i-1);
     }
%>
<%
     out.println(fact(5));
%>
</BODY>
</HTML>






<%!
fun(){
'
%>Hello<%
'
'
}
%>
<%
     fun();
%>

I think you can use the above instead of System.out.println("Hello");

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