wblakemd said the following on 01/27/2011 10:03 AM:
> articleListener (configures the articleService object) ->
> articleService (has an init function which creates the article DAO
> object) -> articleDAO (init sets the datasource name for all local
> functions).
Time to sprinkle in ColdSpring to manage your model objects.  This way
they are instantiated, put into memory and then wired into the listeners
for you (use the m2 specific "depends" attribute).

http://trac.mach-ii.com/machii/wiki/UsingColdSpringWithMach-II

> The above works fine as long as I am making use of the framework, but
> ajax is outside of the framework.  Does anyone know how (or if) I can
> call the articleService object, run its initialization function, and
> call the correct method (which will make use of the articleDAO object)?
If you don't want to use ColdSpring (or even if you do use it), there is
nothing wrong with having your AJAX framework hit a M2 event-handler
that specifically supplies XML or JSON in the response.  I have plenty
of Mach-II applications that use AJAX talking to event-handlers (the
Mach-II dashboard -- especially in 1.9 does this all the time).

In all reality, the browser and AJAX are just clients -- they can hit M2
event-handlers -- the only difference is that your AJAX might want full
HTML responses, HTML fragments, XML, JSON, etc.  The nice thing is you
can apply the same filters / plugins if AJAX is calling event-handlers. 
This is a great way to reuse what you've already built.

Lastly, you could build out an M2 endpoint for your AJAX to talk to
(like a REST endpoint).

HTH,
.Peter

-- 
You received this message because you are subscribed to Mach-II for CFML list.
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/mach-ii-for-coldfusion?hl=en

SVN: http://svn.mach-ii.com/machii/
Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/

Reply via email to