Mach-II Monday: Tears, and Sunshine
Well, I managed to pull it off... with a wee bit of help.
I have a working OO class for doing a2rss conversions (which isn't exactly right... it applies the supplied XSLT to the supplied XML doc and returns the resulting document) that I wrote last night. So since I have to start the handheld app for the client, I decided to run thru the Mach-II process using an HTML form to supply the URLs/paths.
First of all, setting up the app was a snap, thanks in large part to Trond's previously mentioned newbie doc and a few key points I'd missed in my reading. Setting up the first event, the form, and the view was easily done in Homesite+, and setting up the listener to connect with atomCFC's API was also very easy.
All-in-all, I found my first real venture into OO to be fantastically rewarding. Things went together better, stayed together better, and were more flexible than I've previously been able to accomplish. I think the assembly went faster and, frankly, now that I'm much more familiar with CFCs than I used to be, the whole process is pretty cool.
But, I found something about Mach-II that I really don't like. Anymore, it won't be an issue, but I think it's counter-intuitive, and since there's enough CFOO newbies, I'll mention it because I could NOT find the answer anywhere.
In the Mach-II.xml file is a common set of entries, and I emulated them to the letter:
< event="feedRSS" access="public">
< listener="feedListener" method="getRSS" resultkey="request.rssText">
< name="feed" contentkey="request.content">
event-handler>
That makes a great deal of sense to me, and fits with my overall impression of the framework. "Take resultKey from listener, supply it to request.content for transmission to the page. Great, a built-in transfer object... my presentation is automagenically abstracted from my logic. Hoorah!
Nope. Ain't so. And nobody, but nobody that I could find had explained where the resultKey went after it had been returned to the resultKey. I changed contentKey to the same as resultKey, and it quit erroring out, but I had absolutely no content.
Well, apparently, as Yoda explained it, the framework sets resultKey to the value returned by the listener. What contentKey actually does is aggregates content, for things like composite pages, so that you can compile several different contentKeys and output them in mainTemplate.cfm, for instance.
This, I think, makes no sense. I would prefer to see the view-page attribute named resultKey for aggregating results... and the contentKey attribute capable of retrieving a value from the event object. It's consistent, more aptly named, and separates view from logic to a greater degree.
That would give us something like this:
< event="feedRSS" access="public">
< listener="feedListener" method="getRSS" resultkey="rssText">
< name="feed" resultkey="content.part1" contentkey="rssText">
event-handler>
When it executes, the listener method returns the resuts of method, which gets inserted into event.{resultKey}. ViewHandler would then:
setContentKey("{contentKey}", event.getArg("{resultKey}"))
Once setContentKey executes, {contentKey} is available in the request scope, which acts as a conduit between the model and the interface. The specified view is implicitly either rendered to the screen or passed back to whichever module handles aggregating screens for podlike outputs based on the presence of a resultKey attribute in the view-page tag.
It just makes more sense to me, I guess...
But, it was explained to me that I could use the event-arg tag in the event-handler block to move the data from the resultKey into the event object:
< event="feedRSS" access="public">
< listener="feedListener" method="getRSS" resultkey="rssText">
< name="rssText" variable="request.rssText">
< name="feed">
event-handler>
Which, I assume, would mean either writing an event facade to give a view access to event data, or using event.getArg() calls to return data to the screen. I like my idea better, though.
I really DO like the idea of using the request scope as a conduit, and I really do like the Mach-II ideal for MVC and even-driven applications. The thing I don't like is the strange naming convention and lack of abstraction from listener response -> request scope -> view.
Anyway, I am now... (checking...) going on 7 hours late for my trip to the gymn, so I must leave. However, despite my travails, I DID get it to work (with a little help from my friends) and the end result can be viewed here. Let me know what you think!
Laterz,
J


11 Comments:
Bear in mind that a view may have several variables - the result of several listener calls - which doesn't fit your proposed model very well.
The solution here is to use the event object as the data bus (which is easy in the view - just say event.getArg("something") for each variable needed by the view) and shuffle listener results into the event object using event-arg.
It would be nicer if resultKey="something" meant 'event.something' or even if resultKey="event.something" was allowed. This has been suggested several times.
Sean A Corfield
"best practice" for now is to use the event-arg tag to place a notify result (resultKey) into the event args, to be accessed by the view via event.getArg().
The only thing that a lot of people would like to see is an additional attribute to the notify tag... something like "eventKey", which would automatically place the notify result into the event args "psuedo" scope.
You can do this right now with a custom listener invoker that checks resultKey for something like "event." and places the notify result into that event arg. It's just kinda hackish that way, so I think you will see the eventKey or whatever attribute in a future framework release.
The event-args scope IS the conduit for data between model and view. I actually try to avoid explicitly using the request scope because event-args are more encapsulated and probably would be easier to recreate outside of mach-ii.
Usa dental inc. infor you about invisalign cost
invisalign cost
and invisalign price
invisalign price
Usa dental inc. infor you about invisalign cost
href="http://invisalign-online.com"> invisalign cost
and invisalign price
href="http://invisalign-online.com/invisalign-price.html">invisalign price
Valium benzodiazepines Verapamil Viagra sildenafil
CipralexCitalopram Celebrex Cefixim
Cephalexin Doxepin Diazepam Dolviran
FEVARIN Fluoxetin Formigran Zoloft
Zyban Zaldiar Zocor Trevilor
Tramadol Tavegil Arcoxia rosiglitazone
ACOMPLIA Biaxin Ezetrol Isotret
Ibuprofen Klipal Levitra Lisihexal
Menogon Mirtazapin Omeprazol Allergy
Blood Pressure Muscle Relaxant Contraceptive Arthritis Rheumatics
Birth Control
java игры
кошмар на улице вязов
запахло весной
портрет Иисуса
ночной дозор
Миша Галустян
выборы 2008
домино
видео для телефона
java игры
novak djokovic
novak djokovic gallery
novak djokovic sexy hot tennis
wilson tennis racket djokovic novak
novak djokovic personal life and love life
biography on novak djokovic
novak djokovic in the buff
novak djokovic slike
novak djokovic in undies
novak djokovic shirtless
novak chest hair djokovic
sexy novak djokovic
novak djokovic underwear
novak djokovic photos
is jelena jankovic the girlfriend of novak djokovic
novak djokovic nude
novak djokovic nude pics
novak djokovic images
novak djokovic and his family
novak djokovic girlfriend
novak bent blog djokovic
pictures of novak djokovic
novak djokovic born again christian
roger federer and novak djokovic match australian open 2008
novak djokovic
novak djokovic gallery
novak djokovic sexy hot tennis
wilson tennis racket djokovic novak
novak djokovic personal life and love life
biography on novak djokovic
novak djokovic in the buff
novak djokovic slike
novak djokovic in undies
novak djokovic shirtless
novak chest hair djokovic
sexy novak djokovic
novak djokovic underwear
novak djokovic photos
is jelena jankovic the girlfriend of novak djokovic
novak djokovic nude
novak djokovic nude pics
novak djokovic images
novak djokovic and his family
novak djokovic girlfriend
novak bent blog djokovic
pictures of novak djokovic
novak djokovic born again christian
roger federer and novak djokovic match australian open 2008
Order Viagra for lowest prices!
Major website to order Viagra online.
Fast, cheap and discreet delivery.
Order Viagra right now!
ORDER VIAGRA ONLINE - CLICK HERE!
How Viagra Works
This medication works to relax those muscles that limit blood flow to the penile area. This blood flow is vital in gaining and maintaining an erection. Without the relaxation of this muscle and blood flow, you are unable to get an erection.
»» ORDER VIAGRA ONLINE - CLICK HERE! ««
tramadol Billig-Viagra im Web hydrochloride Der Pharmakonzern Pfizer zyrtec side effects und der Software-Konzern Microsoft haben viagra side effects Potenzpille Viagra im Internet geklagt buy cialis online medrol viagra uk indocin buy soma online tramadol online viagra for sale discount viagra melatonin side effects xenical hgh phentermine female viagra buy soma diovan hct detrol ultram buy tramadol online nolvadex triphala zestril cheap soma topamax side effects diovan side effects viagra sale amaryl cheap viagra cheap cialis cheap xanax online cheap cialis online
rubbing against my time find this specific need new Ukrainian and for Ukraine, thats teen lesbian anal sex images
hello friend excellent post I'm doing my work graduate and I would like to collect information about Brand Name Vs Generic Drugs!! do you have information or some homework about it???
hello
thans for all info about Online Pharmacy is great
To start with I would like to congratulate the cradores of this blog, mainly because when I read it I enjoyed it very much. A few years ago I attended a conference called guanacaste costa rica real estate, at that conference had many interesting topics. Perhaps readers may find no relationship between the blog and this conference, but if someday can attend, would realize that there is much to do with this blog.
Post a Comment
<< Home