Neptune is (in part) an MVC framework, but the Model View and Controller division are done differently than in most frameworks. We have already covered the view portion (Layout Components and .cfm files) and the model portion (service CFCs), but we haven't covered the controller portion yet.
So far we have relied on the built-in page controller. This handles connections between the view and the model and sets several convenient default attributes for cf_sebForm and cf_sebTable. Sometimes, however, we may want to change those values or add more complicated connections between the view and model layers.
Here is the basic page controller to which other code could be added:
<cfcomponent extends="_config.PageController" output="no">
<cffunction name="loadData" access="public" returntype="struct" output="no">
<cfset var vars = Super.loadData()>
<cfreturn vars>
</cffunction>
</cfcomponent>
Note that for our contact-edit.cfm, the page controller has a built-in "saveContact" method. We could add our own here if we wanted to provide some more complicated translation:
<cfcomponent extends="_config.PageController" output="no">
<cffunction name="loadData" access="public" returntype="struct" output="no">
<cfset var vars = Super.loadData()>
<cfreturn vars>
</cffunction>
<cffunction name="saveContact" access="public" returntype="string" output="no">
<cfreturn variables.Contacts.saveContact(argumentCollection=arguments)>
</cffunction>
</cfcomponent>
Keep the following considerations in mind to keep your application a proper MVC application (the impact on maintainability of following these guidelines is difficult to overstate):
Service-level components
Layout Components and .cfm files
Page Controllers