Hi,
Say I have a
JSP page - A.jsp which includes B.jsp (using include directive), B.jsp includes C.jsp (using include directive).
Now C.jsp instantiates a Bean and calls its method passing some variable as parameter, which returns a
String, using below statements :
<jsp:useBean id="abean" class="com.some.plan.ABean" scope="request" />
<%
out.println( abean.getRequestedString(1) );
%>
The method in the bean is defined as follows :
public String getRequestedString(int code)
{
System.out.println("THIS METHOD CALLED ");
if (code==1)
return "1";
else
return "0";
}
I know that it should and is printing '1' in the browser. But let me come to the strange point now, on the server console , its printing 'THIS METHOD CALLED' two times !!! WHY ? which means the method is being called 2 times.
But if I put the below statement in A.jsp instead of C.jsp :
<%
out.println( abean.getRequestedString(1) );
%>
( since abean instance will also be available in A.jsp (after A.jsp includes C.jsp), putting the above statement in A.jsp is legal )
Now, after doing this change, on the browser it will print '1' and at the server console , 'THIS METHOD CALLED' is printed once, which according to me is right. But why if the above statement be put in C.jsp, the server console shows that the method is called two times.
Pls. someone let me know...
[ May 08, 2002: Message edited by: Sam Cala ]