The following code would get you the result you are looking for :

<%@ page import = "javax.servlet.jsp.*, java.io.*" %>

<html>
<title>Test 9</title>
<body>
<%!
public String InnFunc(String par, JspWriter out) throws IOException
{
 out.println("In InnFunc<BR>");
 out.println("entering dblInnerFunction<BR>");
 String dblinnFunc = dblInnFunc("in",out);
 out.println("Out of dblInnerFunction<BR><BR>");
 return dblinnFunc;

 }
 public String dblInnFunc(String par, JspWriter out) throws IOException
 {
  String temp = "out";
  out.println("In dblInnFunc<BR>");
  return temp;
 }
%>

<%
 out.println("In main<BR>");
 out.println("entering InnerFunction<BR>");
 try{
   String innFunc = InnFunc("in",out);
 }catch(IOException e){
   out.println("Caught an IOException : " + e);
 }
 out.println("Out of InnerFunction<BR><BR>");
%>
</body></html>

Have a nice day.
With regards,
Sachin S. Khanna.
www.emailanorder.com
----- Original Message -----
From: Divya M A <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 09, 2000 10:29 PM
Subject: How to write functions and procedures in JSP?


> Hi!
>     I looked around for some information regarding this, but no
success....
> I don't understand what's wrong with the following code:
>
> <%!
> public String InnFunc(String par)
> {
>  System.out.println("In InnFunc<BR>");
>  System.out.println("entering dblInnerFunction<BR>");
>  String dblinnFunc = dblInnFunc("in");
>  System.out.println("Out of dblInnerFunction<BR><BR>");
>  return dblinnFunc;
>
> }
> public String dblInnFunc(String par)
> {
>  String temp = "out";
>  System.out.println("In dblInnFunc<BR>");
>  return temp;
> }
> %>
>
> <%
> out.println("In main<BR>");
> out.println("entering InnerFunction<BR>");
> String innFunc = InnFunc("in");
> out.println("Out of InnerFunction<BR><BR>");
> %>
>
> The output, the above program gives is:
> In main
> entering InnerFunction
> Out of InnerFunction
>
> While what I expect it to print is:
> In main
> entering InnerFunction
> In InnFunc
> entering dblInnerFunction
> In dblInnFunc
> Out of dblInnerFunction
> Out of InnerFunction
>
> What could possibly be wrong. Am not very fluent in JSP or Java.
> Thanks in advance.
> Divya.
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>

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

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to