We all need values in our applications. That is why we interact with the request context in order to place data from our model layer into it so our views can display it, or to retrieve data from a user's request. You will either interact with the event object to get/set values or put/read values directly via the received rc and prc references.
We would recommend you use the private request collection (prc) for setting manual data and using the standard request collection (rc) for reading the user's unsafe request variables. This way a clear distinction can be made on what was sent from the user and what was set by your code.
//set a value for views to useevent.setValue( "name","Luis" );event.setPrivateValue( "name","Luis" );// retrieve a value the user sentevent.getValue( "name" );// retrieve a value the user sent or give me a default valueevent.getValue( "isChecked",false );// retrieve a private valueevent.getPrivateValue( "name" );// retrieve a private value or give me a default valueevent.getPrivateValue( "isChecked",false );// param a valueevent.paramValue( "user_id","" );// param a private valueevent.paramPrivateValue( "user_id","" );// remove a valueevent.removeValue( "name" );// remove a private valueevent.removePrivateValue( "name" );//check if value existsif( event.valueExists( "name" ) ){}//check if private value existsif( event.privateValueExists( "name" ) ){}// set a view for renderingevent.setView( 'blog/index' );// set a layout for renderingevent.setLayout( 'main' );// set a view and layoutevent.setView( view="blog/userinfo", layout="ajax" );
Important The most important paradigm shift from procedural to an MVC framework is that you NO LONGER will be talking to URL, FORM, REQUEST or any ColdFusion scope from within your handlers, layouts, and views. The request collection already has URL, FORM, and REQUEST scope capabilities, so leverage it.