newbie question event/request context


Working with my first CB app here, and getting a bit confused on
things here... would just like some clarification....

whats the difference between the following (in my eventHandlers):

<cfset event.setValue("comments", commentsQuery) />


<cfset rc = event.getCollection() />
<cfset rc.comments = commentsQuery />

where "commentsQuery" is a query object that gets returned from a
model of such... What I'm trying to do is pass a query object back to
my view for a listing.


It's the same...

In your handler: put a value in the request collection
In your view: read it from the request collection


Hi Salomoko!

I’m not too far ahead of you in the CB world, but what you are showing below is exactly the same thing written two different ways. Since I come from a modelglue background, I prefer (or at least am used to) adding values directly to the event with
<cfset arguments.event.setValue(“myvalue”,someval) />

The good folks who wrote CB provide another way that they felt was a bit more intuitive, and that is to grab the key/value pairs collection out of the event object via

and then let you set values to it just like you are used to doing with CF structures:

In the end, when the data arrives at your view, it’s all the same, it’s just a matter of which way of doing it feels more natural to you.

Doug Boude :0)

another newbie question...

why is it I get the same error for everything I do...

Error creating custom error template.
Error Type: MissingInclude : [N/A]
Error Messages: Could not find the included template /app/
Note: If you wish to use an absolute template path (for example,
template="/mypath/index.cfm") with CFINCLUDE, you must create a
mapping for the path using the ColdFusion Administrator. Or, you can
use per-application settings to specify mappings specific to this
application by specifying a mappings struct to THIS.mappings in
Using relative paths (for example, template="index.cfm" or
template="../index.cfm") does not require the creation of any special
mappings. It is therefore recommended that you use relative paths with
CFINCLUDE whenever possible.

it is not very informative at all...

Am I missing something here?

That message simply means that ColdBox cannot find the errortemplate.cfm file in your application. So when an error occurs, you see that message instead of the original one. Look for the following:


That file is not being found.

Check your ColdBox.xm.cfm file, look for the setting CustomErrorTemplate.

right I noticed that. it's defaulted to @errortemplate@ in my coldbox

now I just pointed it to the given error template under /includes/

Not sure what the intent is there, if that original error page wasn't
the default error template what was it? and also why isn't it pointing
to the correct error template by default... now that I pointed it to
the generic_error.cfm page given, it seems alot less aesthetically
inclined than the original error page...

guess I'm confused on what just happened, and why...

excuse the newb-ness... :slight_smile:

but yes, it did narrow down (display the exception) the original error
I was searching for... thanks!

The @errortemplate@ is a marker for the generator to switch the content up. I will update this so it can work without the generation.