I think what's happening is that a new instance of that controller CFC
is being created when the remote call comes in from your getJSON()
call. When that happens, none of the configuration that ModelGlue has
done to the controller that it set up and cached has happened, so
you're getting an error accessing the beans scope because that new
instance was never configured by ModelGlue.

I personally have not seen anyone direct AJAX calls to their
controller CFCs. Most everyone I know of uses some sort of remote
proxy object. I'm working on sometime similar to that right now for
one of my apps.  If you're interested in seeing my approach, ping me
off list and we'll figure out how to get the code to you.

Dan

On Feb 24, 1:24 pm, byron <[email protected]> wrote:
> Hi all.  I have the following MG controller:
>
> component output="false" hint="I am a Model-Glue controller"
> extends="ModelGlue.gesture.controller.Controller"
> beans="chartService,patientService"
>
> {
>
>         private void function init() {
>                 return this;
>         }
>
>         remote string function chartAudits(event) {
>
> arguments.event.setValue("numCharts",beans.chartService.numChartsByWeek());
>        }
>
> }
>
> I'm calling this from my display page using jQuery:
>
> $.getJSON("controller/reportController.cfc?
> method=chartAudits&returnFormat=json",{}, function(res,code) {...});
>
> When I run it I get the following error:
>
> Element CHARTSERVICE is undefined in a Java object of type class
> [Ljava.lang.String;.
> The error occurred in C:\inetpub\wwwroot\Heart2Health\controller
> \ReportController.cfc: line 15
>
> 14 :
> 15 :            numCharts = beans.chartService.numChartsByWeek();
>
> I have verified that I have a bean for chartService.  I can access
> this from public functions.  Any ideas of what I might be doing
> wrong?  Can you use the beans scope in a remote function?
>
> Thanks
>
> Byron

-- 
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en

Reply via email to