AspAlliance.com LogoASPAlliance: Articles, reviews, and samples for .NET Developers
URL:
http://aspalliance.com/articleViewer.aspx?aId=1579&pId=-1
Introducing ColdFusion
page
by Debjani Mallick
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 20385/ 41

Overview

Being the people of 21st century, we must be very familiar with the word Internet and its usefulness. Actually, the internet is not what it used to be. The internet has evolved from a cluster or collection of static pages to providing dynamic content. ColdFusion MX is a developing environment that helps in the development of Internet applications and dynamic websites rapidly and easily.

What is Web Application Server?

Normally, what happens is that when we give a request to a web browser, the browser sends the request to the web server which tries to fulfill the requests by returning the requested data to the browser. But a web server’s capability is limited since there is much functionality that a web server does not allow us to do; for example, interacting with the database, validating user inputs, etc. A web server, basically what it does is locates the information and returns it to the browser. So for extending the functionality of a web server, web application server is used. It is a software program that is capable of doing all the functionalities that a web server cannot perform. Now what happens is that when a browser sends a request, the web server looks at the file extension of the requested URL. If the user requested a simple page like a HTML page, then the web server itself processes the request, but if the user requests a page that a web application server must process like a CFML page or CFC, then the web server passes on the request to the application server. The web application server processes the request and sends the result to the web server which sends on the result to the browser and the user is able to view the page.

What is ColdFusion?

As I said earlier, it is a rapid developing environment. It consists of mainly the parts described below.

·         ColdFusion Scripting Language – It provides an efficient development model for Internet application. CFML sits at the heart of the scripting language.

·         ColdFusion Markup Language – CFML is a tag based language. It looks similar to HTML. It includes starting and ending tags. CFML increases productivity by providing a layer of abstraction that hides many of the low level details of application programming. At the same time, it is powerful and flexible. CFML includes approximately 110 tags and 280 built-in functions. The functionalities provided by them cover a large range including programming constructs such as loop structures, services such as charting and graphing, full text search, etc.

·         ColdFusion MX Administrator – This allows for configuring and managing the ColdFusion application server.

·         Verity Search Server – It is also known as the verity search engine which provides for full text search capability for data and documents on a ColdFusion site.

ColdFusion has been implemented on the Java technology platform and uses a J2EE server for many of its base services. It can be configured to use an embedded J2EE server or it can be deployed to as a J2EE application on an independent J2EE server.

Basics of CFML

Being a dynamic application development tool, CFML includes the feature of a programming language like variables, constants, functions, loops (flow-control tags), etc. CFML also includes CFScript which allows us to use syntax similar to JavaScript for many of the operations. The built-in tags included cover a large range of functionalities like creating forms, manipulating variables, processing ColdFusion pages, accessing database, handling errors, manipulating files and directories, using protocols, etc. One can also create his own custom tags which can encapsulate frequently used code at one place. If custom tags are written using CFML, then they can take the advantage of all the built-in tags and even other custom tags of ColdFusion. CFX tags are custom tags written in a programming language like Java or C++. Generally, CFX tags are executed faster than CFML custom tags since they are compiled. Similarly, for functions, the built-in functions in ColdFusion can perform a large range of functionalities including creating queries and manipulating them, evaluating the values of dynamic data, performing mathematical operations, etc. One can also create user-defined functions using ColdFusion. ColdFusion components are basically a group of related user-defined functions and variables. They also have the capability of providing and controlling the access to the component's content. ColdFusion components can provide web services and also make them available on the Internet. They can also provide ColdFusion services that Flash clients can call directly.

Now, coming down to variables and constants, constants are simple scalar values whose value does not change during program execution. Variables' value can be set and reset. The two main characteristic of a variable is its scope and its data type. Some examples for the scope of a variable are the following.

·         Variables scope (local) – It is the default scope whenever we declare a variable using the cfset and cfparam tags. Such types of variables are only available on the page on which they are declared.

·         Form – These variables are the form variables which are sent to the form’s action page on submission of the form.

·         URL – The parameters passed in the URL to call the current page.

·         Request – These variables are available to all pages. These are used to hold the information that is required for the duration of a HTTP request.

·         CGI – These variables are environment variables identifying the context in which the page was requested.

·         Cookie – These are the variables present in the user’s browsers as cookies.

·         Client – These variables are associated with one client.

·         Session – These variables are associated with one session. These are available for the time for which the client maintains a session.

·         Application - These variables are associated with one application on the server.

·         Server - These variables are associated with one ColdFusion server.

·         Arguments – These are the variables passed which call a user-defined function.

Similarly, for the data type of a variable, it can be:

·         Simple, representing one value. For example, strings, integers, Boolean values, etc.

·         Complex, like arrays, structures, etc.

·         Binary, representing raw data like the content of a GIF file.

·         Object, like Java, web services, ColdFusion components objects, etc.

ColdFusion includes a lot of flow control tags like cfif, cfelse, cfelseif, cfswitch, cfcase, cfdefaultcase, cfloop, cfbreak, efexit, etc. cfif, cfelse and cfelse provide the functionality of if-then-else conditional processing. If a condition is true, then execute a block of code and if not, then execute the block of code in cfelse part. If multiple conditions are given, check for each condition and whichever condition satisfies, execute the block of code for that condition. Similarly, cfswitch, cfcase and cfdefaultcase allow for selecting from a set of different codes depending on the value of an expression. The cfloop tag allows looping over a block of code for a desired number of times. cfbreak tag is used to exit the cfloop.

CFScript tag in ColdFusion is used to write code in programming language similar to Java, but is simpler than Java. It provides an efficient way to write ColdFusion logic.

Conclusion

This article was an introduction to ColdFusion describing the basics of ColdFusion markup language. I am sure after reading this article you have developed a basic idea on ColdFusion.

By Debjani Mallick


Product Spotlight
Product Spotlight 

©Copyright 1998-2021 ASPAlliance.com  |  Page Processed at 2021-04-13 1:21:33 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search