You can't directly call functions in a JSP page.  However, JSP and CF
can share scopes.  You'd have to rewrite your JSP page to put variables
in the REQUEST scope.  Here's an example:

JSP PAGE
--------
<%                      
        ThreadGroup threadGroup =
Thread.currentThread().getThreadGroup().getParent();
        Thread threadList[]=new Thread[Thread.activeCount()];   

        threadGroup.enumerate(threadList);
        request.setAttribute("threads", threadList);
%> 

CFML PAGE
---------
<cfscript>
// Call the JSP page
GetPageContext().include("jspPage.jsp");

// REQUEST.THREADS populated from JSP call
QueryAddRow(ThreadQuery, arrayLen(request.threads));
                
for ( thread = 1; thread lte arrayLen(request.threads); thread = thread
+ 1 )
{
    code... code... code...
}
</cfscript>

-----Original Message-----
From: stylo stylo [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 31, 2006 8:50 AM
To: CF-Talk
Subject: how (the heck) to call functions on a jsp page?

I need to either rewrite some functions into cf (see my asp conversion
thread) or include a jsp file and call 2 functions in there. To the
latter:

1) the jsp file has at the top "<%@ page import = "java.sql.*,
java.util.*, java.util.zip.*" %>" followed by 2 functions.

Is that a problem? Are those special classes or regular ones the shared
cf7 server will have already?

2) how do I call the 2 functions in the jsp page? I know I can use a

 GetPageContext().include("hello.jsp?name=Bobby");

style but I don't need to include url variables, I need to call the
functions there. How exactly do I call them???

Or I also found this example:


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241922
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to