精华内容
参与话题
问答
  • COLDFUSION

    2007-03-07 13:35:07
    ColdFusion知识 ColdFusion的定义 ColdFusion可以从两方面来定义,它既是一种应用服务器也是一种编程语言。很多开发人员常常把它们当成一件事,他们用ColdFusion语言(CFML - ColdFus...
    ColdFusion知识
    ColdFusion的定义
    ColdFusion可以从两方面来定义,它既是一种应用服务器也是一种编程语言。很多开发人员常常把它们当成一件事,他们用ColdFusion语言(CFML - ColdFusion Markup Language)来编写应有程序,并把编写的应用程序运行在ColdFusion服务器上。 但是用ColdFusion语言编写的应用程序可以运行在其它支持CFML的应用服务器上,如J2EE应用服务器,这样一来就给那些高端的应用服务器提供了另一种简洁高效的开发语言。不管您选择使用ColdFusion应用服务器还是选择使用其它的应用服务器,CFML语言都为您提供了一个快速开发功能强大的应用程序的有效方案。

    ColdFusion的历史有多久?
    ColdFusion开始于1995年,是历史最悠久的最为成熟的互联网应有服务器。

    有多少企业组织或个人使用ColdFusion?
    在全世界范围内有超过1万个组织,12万台以上的服务器在运行ColdFusion.

    有多少开发人员在使用ColdFusion?
    保守估计,大概有35万。但实际上的数字远远大于35万,一台运行ColdFusion的服务器上可以运行的多个ColdFusion程序,因此在一台服务器上进行开发的程序员也会有很多。

    和其它应用服务器相比,ColdFusion有多少成功?
    应该说是非常成功的,ColdFusion是商业(需购买)应用服务器中的佼佼者,在使用量上仅次于ASP。在财富100当中有超过75%的企业在使用ColdFusion.

    ColdFusion可以编写那些类型的应用程序呢?
    ColdFusion可以用来编写各种各样的应用程序,包括动态互联网网站,电子商务网站或门户网站,但最主要的还是大量的企业内部互联网应用程序和数据库相关的应用程序。这一点始终是也将一直会是ColdFusion的强项。


    为什么我能看到的用ColdFusion开发的站点并不是很多?
    其实用ColdFusion开发的站点是非常多的。但是由于大多数基于ColdFusion的应用程序都是企业内部互联网应用程序给以及和敏感数据库相关的应用程序,并不是对外公开的。所以看上去用ColdFusion的并不是很多。如果您想了解一下那些重要的企业在使用ColdFusion请访问如下地址:http://www.macromedia.com/ http://www.forta.com/cf/using/

    为什么那些公司会花钱购买ColdFusion,而不使用‘免费’的ASP或PHP?
    说其它的一些应用服务器是免费的其实有点言过其实。的确,一些应用服务器可以被免费下载,但所提供的只是一些基本的核心的功能。在ColdFusion中提供了大量非常重要的功能和服务,如图表生成,全文搜索以及其它一些有用的模块如文件上传的处理和电子邮件的处理,而在ASP或PHP中这些模块都是要另外购买的。 最近的一项估算表明,如果要在ASP中加上ColdFusion专业版所提供的所有功能,总成本会到达3万美元。与此同时售价低于1千美元的ColdFusion专业版却集成了这些功能。而这还不包括由于使用了ColdFusion而减少的学习以及开发所需的周期和成本。

    ColdFusion是不是属于专有技术,使用专有技术是不是很难得到保障?
    不,ColdFusion不是专有技术。事实上,有不少其它产品(通过其它厂商)也是用CFML(或部分)来实现的。另外,ColdFusion充分利用了大量公开的技术标准,从数据库的集成(JDBC ,ODBC)到用XML来实现配置文件到使用J2EE作为ColdFusion的底层核心。

    CFML的全称是ColdFusion Markup Language,是一种特别适于用来编写互联网应用程序的语言。CFML看上去和传统的编程语言并不太一样,更接近HTML,因此和HTML一样非常的易学易用。CFML可以在ColdFusion应用程序服务器上运行,也可以在其它一些应用程序服务器运行。[@more@]
    COLDFUSION

    来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7776827/viewspace-903228/,如需转载,请注明出处,否则将追究法律责任。

    转载于:http://blog.itpub.net/7776827/viewspace-903228/

    展开全文
  • ColdFusion

    2008-03-25 17:35:00
    ColdFusion is an application server and software development framework used for the development of computer software in general, and dynamic web sites in particular. In this regard, ColdFusion is a s
     ColdFusion is an application server and software development framework used for the development of computer software in general, and dynamic web sites in particular. In this regard, ColdFusion is a similar product to ASP.NET or Java Enterprise Edition.

    The primary feature of ColdFusion is its associated scripting language, ColdFusion Markup Language (CFML), which compares to JSP, C#, or PHP and resembles HTML in syntax. "ColdFusion" is often used synonymously with "CFML", but it should be noted that there are additional CFML application servers besides ColdFusion, and that ColdFusion supports programming languages other than CFML, such as server-side Actionscript.

    Originally a product of Allaire, in 2001 the company was purchased by Macromedia, who subsequently merged with Adobe Systems in 2005.

    ColdFusion is most often used for data-driven web sites or intranets. More advanced users can use ColdFusion as a productivity layer above a J2EE platform or use ColdFusion as middleware in a service oriented architecture (SOA), generating SOAP or RESTful web services or Flash remoting.

     ColdFusion(直译:冷聚变),是一个动态Web服务器,其CFML(ColdFusion Markup Language)是一种程序设计语言,类似现在的JavaServer Page里的JSTL(JSP Standard Tag Lib),从1995年开始开发,其设计思想被一些人认为非常先进,被一些语言所借鉴。

    Coldfusion 最早是由 Allaire 公司开发的一种应用服务器平台,其运行的 CFML(ColdFusion Markup Language) 针对Web应用的一种脚本语言。文件以*.cfm为文件名,在ColdFusion专用的应用服务器环境下运行。在 Allaire 公司被 Macromedia 公司收购以后,推出了 Macromedia ColdFusion 5.0,类似于其他的应用程序语言, cfm文件被编译器翻译为对应的 c++ 语言程序,然后运行并像浏览器返回结果。

    自Macromedia接收Allaire公司后,把原来基于C++开发的ColdFusion改为基于JRun的J2EE平台的一个Web Application(JRun也是Allaire公司的一个J2EE服务器产品),并正式推出 Macromedia ColdFusion MX 6.0 版本,此时的cfm运行原理就和java非常的类似,cfm文件被应用服务器编译为对应的 java 代码并编译成 .class 文件在 jvm 虚拟机上运行。从此ColdFusion完全从一个功能齐全的动态Web服务器转变为一个J2EE应用服务器。同时依旧保留了原有版本的所有特性。

    ColdFusion 的页面后缀通常为.cfm,同时 Macromeida 公司在发布 ColdFusion MX 的时候借鉴于 java 面向对象设计风格,设置了 .cfc 这样的 ColdFusion 文件后缀,他们被称作 ColdFusion Components [CFM组件]。 cfc 文件就好比一组 cfm function 的集合,使对应的代码具有高度的可重用性。虽然 .cfc 和 custom tag 具有类似的重用性,但 cfc 提供了更加灵活的调用方式,例如 webservice 方式的调用支持。

    CFM 并不等同于 ColdFusion。 CFM 是一种标志语言,而 ColdFusion 是一种应用服务器环境。对于标准的语法结构的 cfm,cfc 文件,它们不仅仅可以运行在 Macromedia ColdFusion 服务器上,同样的也可以直接在BlueDragon服务器环境下。

    展开全文
  • ColdFusion9升级到ColdFusion16的详细介绍方法 日语版
  • coldfusion_ColdFusion入门

    2020-07-30 17:33:58
    coldfusionColdFusion MX is the newest version of an already fantastic product developed by Macromedia, arguably the biggest and best producer of Web software out there. CFMX, as it’s commonly referre...

    coldfusion

    ColdFusion MX is the newest version of an already fantastic product developed by Macromedia, arguably the biggest and best producer of Web software out there. CFMX, as it’s commonly referred to, is built on top of J2EE (Java 2 Enterprise Edition), and as a result, is much more robust that previous versions of ColdFusion. If you are wondering whether or not you should upgrade that old copy of 3.1 you still have lying around, the answer is a resounding “yes!”

    ColdFusion MX是Macromedia开发的已经非常出色的产品的最新版本,可以说是最大和最好的Web软件生产商。 众所周知,CFMX是在J2EE(Java 2企业版)的基础上构建的,因此,它比以前的ColdFusion版本更健壮。 如果您想知道是否应该升级仍然存在的3.1的旧版本,答案是肯定的“是!”。

    If you’re just starting out, you probably have a bunch of questions. “Just what is ColdFusion? Do I need to know Java since it is built on J2EE? Why should I use CFMX instead of ASP or other free scripting language?” Let me answer these questions one at a time:

    如果您只是刚入门,可能会遇到很多问题。 “什么是ColdFusion? 因为Java是基于J2EE构建的,所以我需要了解它吗? 为什么我应该使用CFMX而不是ASP或其他免费脚本语言?” 让我一次回答以下问题:

    1. First of all, ColdFusion MX is a fully functional application server. CFMX will work in conjunction with most popular Web server software available, including Apache, IIS and Deerfield Website. Think of it like this: let’s say you use IIS. In this scenario IIS will act as the batter in a baseball game. The pitcher is a Web user and ColdFusion is the catcher.

      首先,ColdFusion MX是功能齐全的应用程序服务器。 CFMX将与大多数流行的Web服务器软件一起使用,包括Apache,IIS和Deerfield网站。 这样想:假设您使用IIS。 在这种情况下,IIS将充当棒球比赛的击球手。 投手是Web用户,ColdFusion是捕手。

      In a typical “game”, the user “pitches” an http request for an html page and the batter (that’s the Web server software) hits the request back to the user. With CFMX, a user “pitches” a request for a ColdFusion file. The Web server steps back and let’s the catcher (ColdFusion) take the CFML request and pass it back to the user. I know this analogy is a bit odd but it usually helps illustrate where CFMX fits into the picture.

      在典型的“游戏”中,用户将“ http”请求发送给html页面,击球手(即Web服务器软件)将请求发回给用户。 使用CFMX,用户可以“提出”对ColdFusion文件的请求。 Web服务器退后一步,让捕获器(ColdFusion)接收CFML请求并将其传递回用户。 我知道这个比喻有点奇怪,但通常可以帮助说明CFMX适合图片的位置。

      Secondly, ColdFusion is a powerful server-side scripting language. And believe me, it’s as robust as any language out there. This language consists of tags similar to HTML tags, and FUNCTIONS similar to those found in Visual Basic.

      其次,ColdFusion是一种功能强大的服务器端脚本语言。 相信我,它和那里的任何语言一样强大。 该语言由类似于HTML标记的标记和类似于Visual Basic中的标记的功能组成。

    2. Third in this line of questions is “Why should I use CFMX instead of another free scripting language?”. I believe that Ben Forta answered that question with a bang in a recent issue of ColdFusion Developer’s Journal. The short version is “you get what you pay for” and CFMX, while it’s not cheap, does deliver a boat-load of features that would cost you many times the price of CFMX in another “free” language.

      问题的第三条是“为什么我应该使用CFMX而不是另一种免费的脚本语言?”。 我相信本·福塔(Ben Forta)在最近一期的《 ColdFusion开发人员杂志》中大声地回答了这个问题。 简短的版本是“您付钱”,而CFMX并不便宜,但确实提供了大量功能,而另一种“免费”语言的价格却是CFMX的许多倍。

    3. Do you need to know Java to use CFMX? No. CFML puts a simple and easy to use language between you and cumbersome Java.

      您需要了解Java才能使用CFMX吗? 不。CFML在您和繁琐的Java之间使用了一种简单易用的语言。

    Ok, enough already! Let’s get coding!

    好的,已经足够了! 让我们开始编码吧!

    I’ve already said that CFML is similar to HTML, but what’s the difference between HTML and CFML? Simple. All ColdFusion tags start with the letters “CF”, allowing you to tell what’s static HTML and what’s ColdFusion code. When ColdFusion reads a CFML page and comes across a ColdFusion tag, it performs the specified task, and returns HTML to the end user. One of the reasons that CFML is so powerful is that it works perfectly with existing HTML. You may embed CF tags into your static HTML and even use ColdFusion to write HTML code for you in many cases. Let’s give it a try.

    我已经说过CFML与HTML相似,但是HTML和CFML有什么区别? 简单。 所有ColdFusion标记均以字母“ CF”开头,从而使您能够分辨出什么是静态HTML以及什么是ColdFusion代码。 当ColdFusion读取CFML页面并遇到ColdFusion标签时,它将执行指定的任务,并将HTML返回给最终用户。 CFML如此强大的原因之一是,它可以与现有HTML完美配合。 在许多情况下,您可以将CF标签嵌入到静态HTML中,甚至可以使用ColdFusion为您编写HTML代码。 试一试吧。

    第1课:CFML的简单技巧 (Lesson 1: The Simple Art of CFML)

    Let’s start this off with perhaps the most basic and heavily used ColdFusion tag:<CFOUTPUT></CFOUTPUT> The “cfoutput” tag allows tells ColdFusion Server to “output” or display data between these tags. By itself, <CFOUTPUT> is useless, but if you combine it with double pound-signs (##), it becomes the basis for the CFML language structure. A completed output tag would appear something like this:

    让我们从最基础和使用最频繁的ColdFusion标签开始: <CFOUTPUT></CFOUTPUT> “ cfoutput”标签允许告诉ColdFusion Server在这些标签之间“输出”或显示数据。 就其本身而言, <CFOUTPUT>是没有用的,但是如果将其与双井号(##)结合使用,它将成为CFML语言结构的基础。 完成的输出标签将显示如下:

    <CFOUTPUT>#VariableName#</CFOUTPUT>

    Note: You cannot place cfoutput tags inside other cfoutput tags as a rule. If you do, you will receive an error to tell you that you have invalidly nested cfoutput tags. There is a way and reason to do this, but it goes beyond the scope of this simple tutorial.

    注意:通常,您不能将cfoutput标签放置在其他cfoutput标签内。 如果这样做,您将收到一条错误消息,告诉您嵌套无效的cfoutput标记。 有这样做的方法和理由,但这超出了本简单教程的范围。

    Now, let’s produce a simple output. With most programming languages. you always seem to learn a “Hello World” script first, so let’s start with this:

    现在,让我们产生一个简单的输出。 使用大多数编程语言。 您似乎总是总是首先学习“ Hello World”脚本,所以让我们从这里开始:

    1. Make sure that you have installed CFMX.

      确保已安装CFMX

    2. Be sure that ColdFusion MX Service is running.

      确保ColdFusion MX服务正在运行。
    3. Create a new folder named Lesson1 under the Webroot of the CFMX Server. C:CFUSIONMXWWWROOTLESSON1

      在CFMX服务器的Webroot下创建一个名为Lesson1的新文件夹。 C:CFUSIONMXWWWROOTLESSON1
    4. Open Cold Fusion Studio or another of your favorite text editors. I recommend ColdFusion Studio or Homesite for this function. You can also use Dreamweaver MX in code-view. This lesson will not refer to any of the visual CFML in that application.

      打开Cold Fusion Studio或您喜欢的其他文本编辑器。 我建议使用ColdFusion Studio或Homesite来实现此功能。 您也可以在代码视图中使用Dreamweaver MX。 本课将不涉及该应用程序中的任何可视CFML。
    5. Create a new blank CFML page. It will look the same as a blank HTML document.

      创建一个新的空白CFML页面。 它看起来将与空白HTML文档相同。
    6. Save this file into your new folder as INDEX.CFM

      将此文件另存为INDEX.CFM到您的新文件夹中
    7. In between the <BODY></BODY> tags, just as you would in HTML, enter the following code:

      <BODY></BODY>标记之间,就像在HTML中一样,输入以下代码:

      <CFSET MyWorld = 'Hello World'> 
      <CFOUTPUT>#MyWorld#</CFOUTPUT>
    8. View the page by opening your browser and entering your IP address (127.0.0.1 in most cases), followed by port 8500 and the folder Lesson1. It should appear like this:

      打开浏览器并输入IP地址(大多数情况下为127.0.0.1),然后输入端口8500和文件夹Lesson1,以查看页面。 它看起来应该像这样:

      http://127.0.0.1:8500/Lesson1/

      http://127.0.0.1:8500/Lesson1/

    Great! Now, let’s break this code sample down:

    大! 现在,让我们分解一下代码示例:

    Breaking Down the Code Sample

    分解代码示例

    <CFSET MyWorld = 'Hello World'>

    Whenever you need to use this variable on this template and this template only, you may "call" the variable into action with the above CFOUTPUT block. Once you leave this page, the variable dies and must either be reset with CFSET, or passed via the query string.

    The name I chose, "MyWorld", is no magic name... it doesn't have any mystical programming properties at all. You could name your variable "clownshoes" if you felt the desire to do so.

    Using the <CFSET> tag as I have above, there are a few basic guidelines that you may wish to follow.

    1. ColdFusion variable names are NOT case sensitive.

    2. ColdFusion variables are typeless. You do not need to declare whether a variable is a string, number, etc.

    3. Consider typing your variable names in "title case" where every word starts with a capital letter, similar to JackPoe or ColdFusion. This just makes it easier to read them. Feel free to adopt any coding practice you see fit, however, you should pick one naming practice and stick to it from here on out.

    4. Never ever use spaces or punctuation in your variable names... ever.

    5. Your variable name should not start with a number.

    6. Make your variable names easy to remember and short (when possible). This makes them easier to remember and quicker to type. Avoid creating variable names like "MyThirdVariableHere". If you have to type that a few dozen times it will get tiring quite fast.

    So, to quickly recap and diagram a typical <CFSET> tag:

    Now let's look at the <CFOUTPUT> block:

    <CFOUTPUT>#MyScript#</CFOUTPUT>

    You will notice that the variable name is encased in double pound signs or hash marks: ##. If you'll play along with the analogy, these are like ColdFusion's "fingerprints". The ColdFusion Server "dusts" a template, and anywhere it finds these "fingerprints", it says "Ah ha! I need to do something here."

    In this case, the server receives a request to display the value of the variable named "MyWorld". So, rather than show you the word "MyWorld", it will show you the value of the variable, which is "Hello World" in this case.

    Let's do another one -- this time we'll introduce two simple FUNCTIONS.

    • Now() - This function grabs the current date and time from the server, and formats them in a standard time-stamp manner.

      Now() -此函数从服务器获取当前日期和时间,并以标准时间戳方式对其进行格式化。

    • DateFormat(date, 'mask') - Using this function, we will override the default formatting of the date created with Now(), and tell ColdFusion how we want it formatted.

      DateFormat(date, 'mask') -使用此函数,我们将覆盖用Now()创建的日期的默认格式,并告诉ColdFusion我们希望如何格式化它。

    <CFOUTPUT>#DateFormat(Now(), 'MM/DD/YYYY')#</CFOUTPUT>

    This line of code will take the current date and reformat it to something like 04/12/2003. The cool thing is that you can treat this whole glob of code as regular text, like so:

    这行代码将采用当前日期,并将其重新格式化为2003年12月12日。 很棒的事情是您可以将整个代码视为常规文本,如下所示:

    Hello, Today Is <CFOUTPUT>#DateFormat(Now(),'MM/DD/YYYY')#</CFOUTPUT>.

    Using this code in this manner, you'll see:

    以这种方式使用此代码,您将看到:

    Hello, Today is 04/12/2003

    Add this code to your INDEX.CFM page and try it out. You can also add some font tags or other formatting HTML around this code to achieve your desired effect.

    将此代码添加到您的INDEX.CFM页面,然后尝试一下。 您还可以在此代码周围添加一些字体标签或其他格式HTML,以实现所需的效果。

    For more uses and formatting options of the DateFormat() function, consult the functions reference section at the end of this article.

    有关DateFormat()函数的更多用法和格式设置选项,请查阅本文结尾的函数参考部分。

    You will notice that we nested functions in this code sample.

    您会注意到我们在此代码示例中嵌套了函数。

    <CFOUTPUT>#DateFormat(Now(), 'MM/DD/YYYY')#</CFOUTPUT>

    ColdFusion allows you to combine or "nest" functions forever. There's no limit to the number of functions you can combine.

    ColdFusion允许您永远组合或“嵌套”功能。 您可以组合的功能数量没有限制。

    Success with ColdFusion is based on two things:

    ColdFusion的成功基于两点:

    1. Know your code. Spend the cash to buy a current CFML Language Reference book and study it. It really is interesting reading.

      了解您的代码。 花现金购买一本最新的CFML语言参考书并进行学习。 这真的很有趣。

    2. Practice. As with anything, practice makes perfect.

      实践。 与任何事物一样,实践使完美。

    Note that in some cases you may want to display a pound sign to the user. To do this, you need to "escape the pound sign". This is done by placing two ## together with no information between them. ColdFusion will interpret this as a single character, not a variable to be processed.

    请注意,在某些情况下,您可能希望向用户显示井号。 为此,您需要“转义英镑符号”。 这是通过将两个##放在一起而没有任何信息来完成的。 ColdFusion会将其解释为单个字符,而不是要处理的变量。

    For example, if you use the <CFOUTPUT> tag around a table, and in your HTML tags you try to designate a BGCOLOR="#FFFFCC", ColdFusion will read this as the start of a process. To properly escape this you would enter BGCOLOR="##FFFFCC"

    例如,如果在表周围使用<CFOUTPUT>标记,并且在HTML标记中尝试指定BGCOLOR="#FFFFCC" ,则ColdFusion将其视为过程的开始。 要正确地对此进行转义,您可以输入BGCOLOR="##FFFFCC"

    第2课:使用ColdFusion显示数据库内容 (Lesson 2: Using ColdFusion to Display Database Contents)

    Perhaps the biggest feature of ColdFusion is the amazingly simple way it interacts with databases. CFMX can tie into just about any database you can think of… Oracle, MS SQLServer, MySQL (my personal fave), MS Access, FileMaker, Sybase, Informix (my least favorite!) and more!

    也许ColdFusion的最大功能是它与数据库交互的惊人简单方式。 CFMX几乎可以绑定到您可以想到的任何数据库中……Oracle,MS SQLServer,MySQL(我的最爱),MS Access,FileMaker,Sybase,Informix(我最不喜欢!)等等!

    To work with CFMX and databases, you need to understand two things. ODBC and SQL.

    要使用CFMX和数据库,您需要了解两件事。 ODBC和SQL。

    • ODBC stands for Open Database Connectivity, and is the basis on which ColdFusion connects to most standard databases.

      ODBC代表开放数据库连接,是ColdFusion连接到大多数标准数据库的基础。
    • SQL or “See-Quill” is the basic language that’s used to talk to databases. It’s a simple language that can make or break you as a developer. I suggest picking up a copy of Learn SQL in 10 Minutes by Ben Forta. This lesson assumes that you don’t know SQL, though, so I’ll keep it simple.

      SQL或“ See-Quill”是用于与数据库对话的基本语言。 这是一种简单的语言,可以使您成为开发人员,也可能使您失望。 我建议选择Ben Forta的《 10分钟之内学习SQL》的副本。 不过,本课假定您不了解SQL,因此我将使其保持简单。

    First things first: we need a database! To save time, I’ve created a very simple database for you to download and use. It requires at least Microsoft Access 2000 — so make sure you have it before you continue.

    首先,我们需要一个数据库! 为了节省时间,我创建了一个非常简单的数据库供您下载和使用。 它至少需要Microsoft Access 2000-因此在继续之前请确保已安装。

    Now, we need to create a simple ODBC connection. This will require connecting to CFMX Administrator, the control panel that allows you to interact with the ColdFusion Application Server.

    现在,我们需要创建一个简单的ODBC连接。 这将需要连接到控制面板CFMX Administrator,该面板允许您与ColdFusion应用程序服务器进行交互。

    1. Browse to 127.0.0.1:8500/cfide/administrator

      浏览至127.0.0.1:8500/cfide/administrator
    2. Enter your password. You should know this… if you installed the server properly. If you forget it, look at CFFAQ.com for details.

      输入密码。 您应该知道这一点……如果正确安装了服务器。 如果您忘记了它,请访问CFFAQ.com了解详细信息。

    3. In the left navigation, click the “Data Sources” link.

      在左侧导航中,单击“数据源”链接。
    4. In the Data Source Name field, enter “CFData” without the quotes.

      在“数据源名称”字段中,输入不带引号的“ CFData”。
    5. Open the dropdown list, select Microsoft Access and click ADD.

      打开下拉列表,选择Microsoft Access,然后单击添加。
    6. Browse the server to the database, or type in the path to the file manually.

      将服务器浏览到数据库,或手动输入文件的路径。
    7. Click SUBMIT.

      单击提交。

    8. If you did everything right, CFMX will display a message saying that the Data source was updated successfully, and you’ll see “OK” next to your source in the list of connected data sources.

      如果一切正确,CFMX将显示一条消息,说明数据源已成功更新,并且在已连接数据源列表中,您的源旁边将显示“确定”。

    Now that you have an ODBC connection, let’s look at the database itself. This database is about as simple as possible, and contains just one table that holds a few records. In the real world, this rarely happens.

    现在您已经有了ODBC连接,让我们看一下数据库本身。 该数据库尽可能简单,仅包含一个包含一些记录的表。 在现实世界中,这种情况很少发生。

    If you’re unfamiliar with relational databases, Access is a good place to practice, but, a word to the wise: Access isn’t the best solution to your database needs. If you are looking at low traffic and minor data updates, then you’ll be fine with Access. If you are building a huge database against hundreds of thousands of records and/or expect high usage, consider trying MySQL… and if you can afford them trying SQLServer or Oracle.

    如果您不熟悉关系数据库,Access是一个练习的好地方,但是明智的选择:Access并不是满足数据库需求的最佳解决方案。 如果您查看的是低流量和少量数据更新,则可以使用Access。 如果您要建立成千上万条记录的大型数据库和/或期望使用率很高,请考虑尝试使用MySQL…,如果您可以负担得起SQLServer或Oracle,则可以考虑使用。

    Our database in this case contains a few records in the table named INFO. If you don’t know what a database table is, think of it as a big spreadsheet that holds all your data. Inside this table are records comprised of data stored in columns. It’s really quite simple.

    在这种情况下,我们的数据库在名为INFO的表中包含一些记录。 如果您不知道数据库表是什么,可以将其视为容纳所有数据的大型电子表格。 该表内部是由存储在列中的数据组成的记录。 这真的很简单。

    This database contains the following columns:

    该数据库包含以下列:

    NAME
     ADDRESS  
     CITY  
     STATE  
     ZIP  
     PHONE  
     EMAIL  
     NOTES  
     ID

    Note that the ID column is your PRIMARY KEY. This is the standard way Access creates a unique identifier for each record in a database.

    请注意,ID列是您的PRIMARY KEY 。 这是Access为数据库中的每个记录创建唯一标识符的标准方法。

    Now, we’re going to use CFML to suck some of this data out onto the screen.

    现在,我们将使用CFML将一些数据吸到屏幕上。

    1. Create a new folder under the CFMX Webroot, named LESSON2.

      在CFMX Webroot下创建一个名为LESSON2的新文件夹。
    2. In your text editor, create a new file and save it as ALLDATA.CFM

      在您的文本编辑器中,创建一个新文件并将其另存为ALLDATA.CFM
    3. Now, in that file, add this code between the BODY tags:

      现在,在该文件中的BODY标记之间添加以下代码:

      <CFQUERY DATASOURCE="CFdata" NAME="getall">   
      SELECT *   
      FROM Info   
      ORDER BY Name ASC   
      </CFQUERY>
    4. Then below this code, add the following HTML:

      然后在此代码下方,添加以下HTML:

      <table align="center" border="1">   
      <CFOUTPUT QUERY="getall">   
      <tr>   
        <td>#CURRENTROW#</td>   
        <td>#NAME#</td>   
        <td>#ADDRESS#<BR>#CITY# #STATE#, #ZIP#</td>   
        <td>#PHONE#</td>   
        <td>#EMAIL#</td>   
        <td>#NOTES#</td>   
      </tr>   
      </CFOUTPUT>   
      </table>
    5. Save the page and view it in your browser.

      保存页面并在浏览器中查看。

    It’s not pretty yet — but it works!

    还不是很漂亮-但可以!

    Let’s review what this code does.

    让我们回顾一下这段代码的作用。

    The CFQUERY tag is the means by which CFML retrieves data from a database. The attributes we specified, DATASOURCE and NAME, are required by CFMX. The NAME attribute of this tag is specified by you, and can be any word that’s easy to remember. Query names cannot contain spaces or punctuation.

    CFQUERY标签是CFML从数据库检索数据的方式。 CFMX需要我们指定的属性DATASOURCENAME 。 此标签的NAME属性由您指定,可以是任何容易记住的单词。 查询名称不能包含空格或标点符号。

    Between the opening and closing CFQUERY tag is the SQL Query itself. This is not CFML, this is SQL, the database language. So just what did we tell the database to do? Let’s look at this in detail.

    在开始和结束CFQUERY标记之间是SQL查询本身。 这不是 CFML,这是SQL数据库语言。 那么,我们告诉数据库要做什么呢? 让我们详细看一下。

    • SELECT *

      SELECT *

      This tells the database to get records. The asterisk means

      这告诉数据库获取记录。 星号表示

      all records. So In short, we’ve told the database to SELECT ALL.

      所有记录。 简而言之,我们告诉数据库SELECT ALL

    • FROM Info

      FROM Info

      Well, now that the database has been told to get all records, it follows that we need to tell it where to get them from. This line tells the database the name of the

      好了,既然已经告知数据库要获取所有记录,那么接下来我们需要告诉数据库从何处获取记录。 这行告诉数据库名称

      TABLE from which we want to select the data. In this case, we want the data from our table, Info.

      TABLE从中我们要选择的数据。 在这种情况下,我们需要来自表Info的数据。

    • ORDER BY Name ASC

      ORDER BY Name ASC

      This last line is really just gravy. It tells the database that, now that we’ve selected all data from the Info table, we want it organized by the column

      最后一行实际上只是肉汁。 它告诉数据库,既然我们已经从“信息”表中选择了所有数据,我们希望它按照该列进行组织

      NAME in ascending alphabetical order. If you wanted to sort the data by descending order, you’d use the abbreviation DESC.

      NAME按字母升序排列。 如果您想按降序对数据进行排序,则可以使用缩写DESC

    What’s so great about CFML and SQL together, is that you can easily use CFML to augment your query to retrieve exactly the data you need… which brings us to the last part of this lesson.

    CFML和SQL的共同之处在于,您可以轻松地使用CFML来扩展查询以准确检索所需的数据……这使我们进入了本课程的最后一部分。

    第3课:使用CFML搜索数据库 (Lesson 3: Using CFML to Search the Database)

    In part two, we used CFML to dump the entire database out to the screen. This works fine for a small database, but in real life it’s rarely useful, and can cause some serious performance problems. The easiest solution is to give users the ability to search the database to find exactly what they need. With CFML this is a snap.

    在第二部分中,我们使用CFML将整个数据库转储到屏幕上。 这对于小型数据库来说很好用,但是在现实生活中它很少有用,并且可能导致严重的性能问题。 最简单的解决方案是使用户能够搜索数据库以找到他们真正需要的功能。 使用CFML,这很容易。

    1. Create a new file inside the lesson2 folder named INDEX.CFM

      在lesson2文件夹中创建一个名为INDEX.CFM的新文件
    2. Between the BODY tags of this document, add an HTML form like so:

      在此文档的BODY标签之间,添加一个HTML表单,如下所示:

      <div align="center">    
          
        <form action="search.cfm" method="POST">    
        Search for:<input type="text" name="k">    
      <input type="submit" value="Find!">    
        </form>    
          
      </div>
    3. Now create another new page named SEARCH.CFM

      现在创建另一个名为SEARCH.CFM的新页面
    4. Between the BODY tags we need to deal with validating the submitted form. Add this code:

      BODY标签之间,我们需要处理验证提交的表单。 添加此代码:

      <CFIF len(FORM.k) IS 0>    
        Oops!<br>    
        You need to enter some search criteria!<br>    
        <a href="javascript:history.back()">Go back</a>     
      and try again.    
          
        <CFELSE>    
          
      <CFQUERY DATASOURCE="CFdata" NAME="findem">    
      SELECT *    
      FROM Info    
      WHERE Name LIKE '%#FORM.k#%'    
      </CFQUERY>    
          
      <CFIF findem.recordcount IS 0>    
          
        Sorry!<br>    
        Your search for <CFOUTPUT>#FORM.k#</CFOUTPUT>     
      did not return any matches.<br>    
      <form action="search.cfm" method="POST">    
        Search again:<input type="text" name="k">    
      <input type="submit" value="Find!">    
        </form>    
          
          
      <CFELSE>    
      <!--- display your results --->    
          
      <table align="center" border="1">    
      <tr><td colspan="6" align="center">Your search returned     
      <cfoutput>#findem.recordcount#</cfoutput> matches.</td></tr>    
          
      <CFOUTPUT QUERY="findem">    
      <tr>    
        <td>#CURRENTROW#</td>    
        <td>#NAME#</td>    
        <td>#ADDRESS#<BR>#CITY# #STATE#, #ZIP#</td>    
        <td>#PHONE#</td>    
        <td>#EMAIL#</td>    
        <td>#NOTES#</td>    
      </tr>    
      </CFOUTPUT>    
      </table>    
      </CFIF>    
        </CFIF>
    5. Save the pages and try them out in your browser.

      保存页面并在浏览器中尝试。

    Now, let's review the code. There's a lot more this time so we'll take it in chunks.

    现在,让我们回顾一下代码。 这次还有很多,所以我们将其分批处理。

    The INDEX.CFM page contains no tricks. It's just a simple HTML form. I named the text field "k" to stand for "keywords"...this is just how I do it.

    INDEX.CFM页面不包含任何技巧。 这只是一个简单HTML表单。 我将文本字段命名为“ k”代表“关键字” ...这就是我的做法。

    SEARCH.CFM contains a load of CFML you've probably never seen before. The first new tag you see is <CFIF>. This is the standard method we use to deal with conditional processing in CFML. This tag has several variations. For full details, check the reference at the end of this article. Basically what this specific use does, is stop users who try to submit for search form without entering any search keywords.

    SEARCH.CFM包含您可能从未见过的CFML负载。 您看到的第一个新标签是<CFIF> 。 这是我们用于处理CFML中条件处理的标准方法。 该标签有多种变体。 有关完整的详细信息,请参阅本文末尾的参考。 基本上,这种特定用途是阻止试图提交搜索表单而不输入任何搜索关键字的用户。

    Conditional processing allows a developer to say "if the sky is blue do this. Otherwise do this or this". This lets you trap events and possible errors, and control them to do exactly what you need.

    条件处理使开发人员可以说“如果天空是蓝色,则执行此操作。否则,请执行此操作”。 这使您可以捕获事件和可能的错误,并控制它们以完全执行所需的操作。

    <CFIF len(FORM.k) IS 0>

    The "len(FORM.k) IS 0" portion of the above tag uses the LEN() function to determine the length of the submitted form field contents. In this case, if the length of the form field is zero, we will stop the page from processing.

    上面标签的“ len(FORM.k) IS 0 ”部分使用LEN()函数确定提交的表单字段内容的长度。 在这种情况下,如果form字段的长度为零,我们将停止处理页面。

    <CFELSE>

    This tag is the "otherwise" condition. So if a user submits proper search criteria, CFMX will continue to process the page.

    此标签是“其他”条件。 因此,如果用户提交正确的搜索条件,CFMX将继续处理该页面。

    Let's take a closer look at that SQL. The first two lines should be familiar, but that last line might be new.

    让我们仔细看看该SQL。 前两行应该很熟悉,但是最后一行可能是新的。

    WHERE Name LIKE '%#FORM.k#%'

    This is the WHERE CLAUSE in SQL. It's used to tell the database exactly what data you want selected. The basic syntax is WHERE ColumnName LIKE 'something'. The "something", if surrounded by quotes, must be a STRING VALUE -- a word or words. Without quotes, you tell the database to match on a number. In this case, we're letting ColdFusion fill in the blank with the form field value submitted by the user.

    这是SQL中的WHERE CLAUSE 。 它用于告诉数据库确切要选择的数据。 基本语法是WHERE ColumnName LIKE '。 如果“东西”用引号引起来,则必须为“ STRING VALUE (一个STRING VALUE 。 不带引号的话,您告诉数据库要匹配一个数字。 在这种情况下,我们让ColdFusion用用户提交的表单字段值填充空白。

    Wildcards: as with many languages, SQL allows you to use wildcards to increase the power of a search. In the above code we use the percent symbol to denote a wildcard. Inside the percent signs we place the submitted form variable "k". Here are some examples:

    通配符:与许多语言一样,SQL允许您使用通配符来增加搜索的功能。 在上面的代码中,我们使用百分号表示通配符。 在百分号内,我们放置提交的表单变量“ k”。 这里有些例子:

    • '%variable%' means CONTAINS the variable value

      ' %variable% '表示包含变量值

    • 'variable%' means START WITH the variable value and ends in anything

      variable% ”表示以变量值开头,并以任何结尾

    • '%variable' means ENDS WITH the variable value and starts with anything.

      ' %variable '表示以变量值结尾,并以任何东西开头。

    The next section of the results code that we need to examine is the next CFIF block. This code checks the RECORDCOUNT of the query, and if it is not zero -- meaning the query returns anything larger than the number zero -- the page will process. Next is a section that states how many records were found that match. Note the way the variable is called: FINDEM.RECORDCOUNT. This uses the query variable RECORDCOUNT, and only displays it once. If you were to place this code inside a CFOUTPUT that contained the QUERY attribute, the code would repeat for each record found! Not at all useful!

    我们需要检查的结果代码的下一部分是下一个CFIF块。 此代码检查查询的RECORDCOUNT ,如果它不为零,则表示查询返回的内容大于零,该页面将被处理。 接下来的部分说明找到匹配的记录数。 注意变量的调用方式: FINDEM.RECORDCOUNT 。 这将使用查询变量RECORDCOUNT ,并且仅显示一次。 如果要将这段代码放在包含QUERY属性的CFOUTPUT内,那么对于找到的每个记录,该代码都会重复! 根本没有用!

    Each ColdFusion query returns three automatic variables. CURRENTROW is the actual numbering of each record. For instance, if your query returns 50 records CURRENTROW would number them 1-50. RECORDCOUNT returns as a number the amount of records your query found. COLUMNLIST returns a comma separated list of the columns in the table searched.

    每个ColdFusion查询返回三个自动变量。 CURRENTROW是每个记录的实际编号。 例如,如果您的查询返回50条记录,则CURRENTROW将其编号为1-50。 RECORDCOUNT以数字RECORDCOUNT返回查询找到的记录数量。 COLUMNLIST返回以逗号分隔的搜索表中列的列表。

    So there you have it! The basics of ColdFusion and CFML. As you can see, it takes some work, but CFML is a simple and effective way to create any kind of Web application you can think of. Keep your eyes peeled for more on CF soon!

    所以你有它! ColdFusion和CFML的基础。 如您所见,它需要一些工作,但是CFML是创建您可以想到的任何类型的Web应用程序的简单有效的方法。 很快就睁大眼睛,继续使用CF!

    标签和功能参考 (Tag and Function Reference)
    <CFOUTPUT></CFOUTPUT>
    Displays the output of a database query, variable or other operation.
    Syntax:
    <CFOUTPUT></CFOUTPUT>
    Displays the output of a database query, variable or other operation.
    Syntax:

    翻译自: https://www.sitepoint.com/get-started-coldfusion/

    coldfusion

    展开全文
  • coldfusion_ColdFusion活动

    2020-07-31 12:28:06
    coldfusion…posted by davidjmedlock: …由 davidjmedlock 发布 : Want to keep up with whats going on in the ColdFusion world? Keep track of Macromedia’s events calendar. There are both in person ...

    coldfusion

    …posted by davidjmedlock:

    …由 davidjmedlock 发布

    Want to keep up with whats going on in the ColdFusion world? Keep track of Macromedia’s events calendar. There are both in person and online events scheduled. There are a few basic ColdFusion seminars as well as some advanced topics such as using ColdFusion with IBM Websphere and developing applications with Flash and Coldfusion. I just may sign up for that one…

    是否想跟上ColdFusion世界的最新动态? 跟踪Macromedia的活动日历 。 既有现场活动,也有在线活动。 这里有一些基础的ColdFusion研讨会以及一些高级主题,例如将ColdFusion与IBM Websphere结合使用以及通过Flash和Coldfusion开发应用程序。 我可以报名参加那个…

    翻译自: https://www.sitepoint.com/coldfusion-events/

    coldfusion

    展开全文
  • coldfusionAfter a decade of Web development, I’ve played with just about every ... I’ve dabbled in ASP, spent considerable time with PHP and, just recently, jumped into the world of ColdFusion. ...
  • coldfusion…posted by davidjmedlock: …由 davidjmedlock 发布 : This is pretty cool. SourceForge is a huge (the largest, I’m sure) open source software web site. There are thousands of projects ...
  • coldfusionI’d like to introduce myself: my name is Kay Smoljak and I’m a ColdFusion developer. I’m going to be posting here from time to time on topics related to my development language of choice....
  • coldfusion…posted by davidjmedlock: …由 davidjmedlock 发布 : I’ve had a few people come to me looking for blogging scripts and pre-built apps, so I thought it’d be useful to post a few of the ...
  • One of the greatest and probably most anticipated features to come with Macromedia’s Coldfusion MX is ColdFusion Components (CFCs). In its most basic form, a CFC is a collection of code and data that...
  • coldfusionOne of the coolest things about any coding language is watching people take it from one area (the web) to another. For example php’ers have hooks into the GTK tool kit which gives them the ...
  • awesome-coldfusion, 出色的ColdFusion框架库和软件的精选列表 出色的ColdFusion 出色的ColdFusion框架。库和软件的精选列表。 灵感来自于的javascript 。请求请求非常欢迎。出色的ColdFusion引擎应用程序框架测试...
  • coldfusion 8手册

    2008-11-19 15:09:46
    coldfusion8查询手册,开发必备的东东哦!
  • coldfusion The technique is by far very 该技术到目前为止非常 Simple!简单! How we can export the ColdFusion query results to DOC file? Well before writing this I researc...
  • coldfusionJudging by many of the comments on my previous post, the licensing cost of ColdFusion is a major issue for many people, given the many free and open source alternatives. This is not a new co...
  • coldfusionIntroduction: If you are reading this now then you should have already read Part I of this article, "ColdFusion Tutorial Part I – Database Integration" If you haven’t read Part I yet I ...
  • coldfusion…posted by davidjmedlock: …由 davidjmedlock 发布 : Many thanks to Sitepoint Forums member creole for letting me know about the Nashville CFUG (ColdFusion User Group) meeting tonight. I...
  • coldfusionRather than succumb to the many premature rumors of its impending demise, ColdFusion continues to thrive, even more so under the auspices of its new owner, Adobe. With the release of ColdFus...
  • coldfusion 介绍: (Introduction:) Welcome to the final chapter of this article. If you have come this far you should have a firm grasp of how to use ColdFusion to make a dynamic site. In this part I ...
  • coldfusion…posted by davidjmedlock: …由 davidjmedlock 发布 : Okay, I wanted to post something about companies, organizations, and people doing cool things with ColdFusion. Here are just a few: ...
  • Content syndication has become a massively popular approach to providing content to a Website’s visitors, as well as providing a means for many people to gather information in one place for quick and...
  • …posted by davidjmedlock: …由 davidjmedlock 发布 : Time flies all too quickly. I’ve been remiss in my posting here and I apologize. I did plan to write a quick note about the security of ...
  • coldfusion…well, the shirt anyway. If you’re eagerly anticipating ColdFusion 9 – codenamed Centaur – you can now get the unofficial tshirt. User groups can get bulk orders with their name on the ...
  • Microsoft has a ColdFusion website out there! This is almost as cool as learning that Microsoft ran (runs) FreeBSD for the HotMail servers. 是真的吗? 微软在那里有一个ColdFusion网站! 这几乎与学习...
  • Adobe ColdFusion

    2018-11-08 00:43:47
    Adobe ColdFusion 简介: Adobe ColdFusion是美国Adobe公司的一款动态Web...Adobe ColdFusion 8、9版本中存在一处目录穿越漏洞,可导致未授权的用户读取服务器任意文件。 默认端口8500 Adobe ColdFusion 文件读取...
  • ColdFusion 简介

    2004-11-16 10:33:00
    ColdFusion是一种可以跟数据库联系的网络程序设计语言。由Allaire公司在1995年首次发布1.0版,现在已经升级到COLDFUSIONMX。为简单,快速,动态网及便于升级的网络应用程序可提供了快速便利的开发环境。特点:简单...
  • ColdFusion 语言

    2004-11-17 23:27:00
    继续吧~~~汉~~都这么半夜三更的了,本来想偷懒,想想都玩了大半天了~而且今天吃得很撑,继续了~~~~~~安装服务器,跟ColdFusion站点的数据库服务器连上,就可以开始工作了。Tags <cfset><cfsetmyVar=...
  • Hacking ColdFusion

    2014-05-08 01:41:00
    http://yxmhero1989.blog.163.com/blog/static/1121579562014120104439831/ 转载于:https://www.cnblogs.com/mujj/articles/3715295.html
  • ColdFusion介绍

    千次阅读 2008-08-20 14:31:00
    ColdFusion(直译:冷聚变),是一个动态Web服务器,其CFML(ColdFusion Markup Language)是一种程序设计语言,类似现在的JSP里的JSTL(JSP Standard Tag Lib),从1995年开始开发,其设计思想被一些人认为非常先进...

空空如也

1 2 3 4 5 ... 20
收藏数 1,375
精华内容 550
关键字:

coldfusion