Introducing ColdFusion for ASP developers

Source: Internet
Author: User
Tags variable
ColdFusion is a stable and reliable Web application service platform. Since 1995, when the Allaire company first released ColdFusion, it has successfully certified
Understand their excellent scalability, cross-platform capabilities, to become the Web application development in the field of one of the mainstream forces. So, as Web application developers, we should at least
Have a basic understanding of the coldfusion.

First, Scripting Basics
Author: Cactus Studio

The server-side scripting language used by ColdFusion is called cold Fusion Markup Language (cfml,coldfusion tag language). The language of CFML
The method is based on HTML tag syntax, which is designed to facilitate developers who are already familiar with HTML to learn CFML. Although understanding some HTML knowledge helps to understand CFML,
But that's not necessary. It should also be noted that no matter what the name of Cfml means, CFML is much more than a label language-it is a function
Complete server-side scripting language, powerful and rich enough to be comparable to VBScript in ASP.

Here are some examples of CFML basic tags:
<!---CFML annotation--->

< CFIF Trim (UserName) is "Bob" >
The user name is Bob.
< Cfelse >
The user name is not bob.
</cfif >

< Cfloop index= "I" from= "0" to= "ten" >
< Cfoutput >
The current value of the counter is #i#< BR >
</cfoutput >
</cfloop >


The first line is the CFML annotation. CFML annotations are very similar to HTML annotations, except that the CFML annotation tag is one more hyphen. In the second statement
The CFIF tag is actually in the CFML if ... The then structure, which is exactly the same as the corresponding statement in VBScript. The third statement is the loop structure, and the
For ..... Next statement is similar. Cfloop tags can also be used to construct with VBScript do ... A while statement resembles a loop. The cfoutput in the Cfloop tag is similar
In response.write--we can use it to output text within a variable. Note that the variable must be delimited with a # symbol.

As you can see, CFML supports all the control structures that can be found in the popular scripting language.

Ii. further understanding of scripting
Author: Cactus Studio


CFML provides several additional basic tags that are useful to web developers. For example, the < Cfform > tag used below provides developers with
Efficient form validation implementation method. In my impression, form validation is one of the most troublesome things in web development, and the cfform tag has unloaded this burden on us.
The validation operation is not done by Cfform itself, but by other tokens contained by Cfform, which automatically generate client JavaScript,
JavaScript to complete the legality check of the form's contents.

For example, the cfinput tag within the cfform. The cfinput tag supports a variety of extended properties that developers can use to precisely control the input content
What kind of validation.

For example, a developer can specify a "mm/dd/yyyy" (American date) or "dd/mm/yyyy" (European date) format for the contents of the tag.
Certificate, you can even specify that the input data must be a valid credit card number. This feature is particularly useful in that it can strip spaces and hyphens in the input content,
The complex validation is then performed on it. All this does not require a developer to write a line of client code.
<!---a few simple examples of forms. ColdFusion is automatically generated to validate the
Client JavaScript code. --->

<!---Enter a form for your credit card number--->
< Cfform action= "creditcard.cfm" method= "POST" name= "Frmmyform" >
Please enter your credit card number:< BR >
< Cfinput type= "Text" required= "YES" validate= "CreditCard"
</cfform >

<!---Enter a US date form--->
< Cfform action= "usdate.cfm" method= "POST" name= "Frmmyform" >
Please enter your birthday (mm/dd/yyyy):< br >
< Cfinput type= "Text" required= "YES" validate= "date"
</cfform >

<!---Enter a European date for the form--->
< Cfform action= "eurodate.cfm" method= "POST" name= "Frmmyform" >
Please enter your birthday (dd/mm/yyyy):< br >
< Cfinput type= "Text" required= "YES" validate= "Eurodate"
</cfform >




The cfform tag can also be used as a container for cfselect tags. The Cfselect tag allows the developer to bind the selection list directly to the database query results. As
As the following code shows, the code to implement this functionality is very concise and compact. In my opinion, the implementation of the Cfselect tag is faster than the same functionality as the ASP
Speed, but also has a better readability.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.