Blog

Brad Wood

July 03, 2012

Spread the word


Share your thoughts

 

Everyone should be familiar with the setView method in the event object which is used for a handler's action to tell the framework which view file should be used to render the event:

 

event.setView(view="general/index");

 

What you may not realize is that calling setView() is optional.  If you don't explicitly set a view file, ColdBox will then look for the view according to the executing event's syntax. So if the incoming event is called general.index and no view is explicitly defined in your handler, ColdBox will look for a view in the general folder called index.cfm.

 

So this event URL:

http://www.example.com/index.cfm/general/index

 

Would default to the following view:

<web root>/views/general/index.cfm

 

Even if you don't use implicit views, it is recommended that your folder structure and naming conventions match beween your handlers and views for uniformity.

 

More info here: http://wiki.coldbox.org/wiki/Layouts-Views.cfm#Implicit_Views

 

P.S. If you depend on implicit views, remember that ColdBox lower cases the view name by default.  To switch this behavior, use the caseSensitiveImplicitViews setting.

 

Add Your Comment

Recent Entries

BoxLang 1.0.0 Beta 23 Launched

BoxLang 1.0.0 Beta 23 Launched

The latest release of BoxLang, Beta 23, marks a significant step forward in our journey to create the ultimate dynamic language for the JVM. Packed with powerful new features, important bug fixes, and thoughtful optimizations, this update is designed to make your development experience smoother, faster, and more reliable, especially after now starting to take 100s of comments and bug reports from our community.

Luis Majano
Luis Majano
November 23, 2024
TestBox Latest Updates and News!

TestBox Latest Updates and News!

We’re thrilled to have launched the new TestBox website and TestBox 6.0! If you haven’t had a chance to explore yet, visit TestBox to discover updated documentation, powerful resources, and features that make testing more efficient than ever.

Maria Jose Herrera
Maria Jose Herrera
November 21, 2024
Is Your ColdFusion Application Ready for the Future?

Is Your ColdFusion Application Ready for the Future?

In a rapidly evolving digital world, maintaining performance, security, and scalability for ColdFusion applications is more challenging than ever. Whether you're using Lucee or Adobe ColdFusion, legacy systems can become a bottleneck for growth, innovation, and user satisfaction. The need to future-proof your ColdFusion applications has never been more critical.

But where do you start?


The Hidden Costs of an Outdated ColdFusion Application

As you...

Cristobal Escobar
Cristobal Escobar
November 21, 2024