Copy link to clipboard
Copied
I have created functions in cfc, the problem now is that the front pages are jsp pages. How can I pass query data from the cfc to the JSP pages? what will the calls from the jsp look like?
Copy link to clipboard
Copied
If you set the functions in the CFC to have an access type of "remote", you can call them as any other web service.
O.
Copy link to clipboard
Copied
You might also need to specify that the return-format is to be "JSON."
Consider what happens when, say, an AJAX-based application makes a request. It submits an HTTP "POST" to a CFC, with the variables (possibly JSON-encoded if they are complex data-types). One of the parameters is "method," which ColdFusion interprets as a specification of the method-name to be called.
ColdFusion looks for the <cffunction> and that its "access=remote." If so, it issues an ordinary function-call. The function returns a result, as usual, which ColdFusion encodes and sends back as the response text.
You can use exactly the same techniques from your JSP-side code, and "it ought to be very easy to do." But remember: it will be asynchronous. You will issue your request to the ColdFusion server, and after some unpredictable amount of time has passed the response will come back. JSP knows how to do such calls, and to handle the results thereof. "It happens all the time." If the strategy you're coming up with isn't "easy," then you're probably barking up the wrong tree and need to look closer.