Using Components in CFML / Invoking With URL Request
Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com’s entire library of video tutorials.
Learn More
Subtitles of the Movie
A component can be invoked using a URL. Although circumstances where this is helpful are limited. If the component method is going to be called using a URL, the access attribute must be set to remote, and the method being called must be specified in the URL. Other arguments can be passed along as name value pairs in the URL. Because the URL is visible to the client, it is not a good idea to pass sensitive variables in a URL string. We'll demonstrate URL invocation with a log out method in the user component. This method will clear any session variables and redirect the user to the main page. Normally you'd not want to have a component handle session variables that it is not setting itself because it has no way of knowing if the variables actually exists. For our purposes though, we know that we will be using this function to log out and the variables will exist. The function name is log out, access is remote and the return type is void. If the session variable userid is defined, this method will clear the variables using the struct clear function and then redirect the user to the main page. Now we'll change the code in the footer file so that the log out navigation item points to user.cfc with the log out method. Now if we go to our "Where's Tom" application and log in then return to the main page and select our log out URL We are logged out and returned to the main page of the application. d out and returned to the main page of the application.
Tutorial Information
| Course: | Macromedia ColdFusion MX |
| Author: | Darcey Spears |
| SKU: | 33474 |
| ISBN: | 1932072772 |
| Release Date: | 2004-03-05 |
| Duration: | 6.5 hrs / 102 lessons |
| Work Files: |
Yes |
| Captions: | For Online University members only |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |
VTC Sign up & Benefits
- Unlimited Access
- 98,729 Video Tutorials (23,265 free)
- Video Available as Flash or QuickTime
- Over 1026 Courses
- $30 for One Month Access
- Multi-User Discounts Available
United States 