ブログトップ 記事一覧 ログイン 無料ブログ開設

うたらぼ(はてな) このページをアンテナに追加 RSSフィード

ここの管理人のうたらぼが 「(Web)アプリを作ろう!」というサイトを作りました。
こんな のも作れます。 詳しくは こちら!!

2014-03-18

[]ColdFusionで1ヶ月24時間を色で確認

元記事はこちらです。

■Application.cfm

<cfsetting enableCFoutputOnly="yes">
<cfapplication name="#hash(GetDirectoryFromPath(GetCurrentTemplatePath()))#">

■index.cfm

<!---/////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////--->
<cfparam name="url.p" default="">
<cfparam name="form.year" default="2014">
<cfparam name="form.month" default="3">
<cfparam name="form.holiday" default="2,9,16,23,30">
<cfparam name="form.data" default="
##FF9966|201403010420-201403010530
red|201403020423-201403020541
aqua|201403030440-201403030515
red|201403032340-201403040515
red|201403050400-201403050450
##CCFF99|201403060410-201403060500
red|201403070420-201403070510
red|201403080430-201403080520
aqua|201403080520-201403080620
red|201403132240-201403150515
red|201403010000-201403010010
aqua|201403010010-201403010025
red|201403010025-201403010045
aqua|201403010045-201403010100
">

<cfset obj = createObject("component", "monthtbl").init(form.year, form.month, form.holiday)>
<cfset obj.setHeight(20)>
<cfset obj.setWidth(20)>
<cfloop index="idx" list="#form.data#" delimiters="#chr(10)##chr(13)#">
    <cfset obj.setDate(idx)>
</cfloop>
<cfset obj.chgDate()>

<cfset content=cst_table(obj.dispTbl())>
<cfset layout(content)>
<!---=================================================================
cst_table
==================================================================--->
<cffunction name="cst_table" returnType="string" output="no">
    <cfargument name="content" type="string" required ="yes">

    <cfset var local = structNew()>

    <cfsavecontent variable="local.tmp">
    <cfoutput>
    #arguments.content#

    <form action="index.cfm?p=1" method="post">
    <table border="1">
        <tr>
            <td></td>
            <td>
                <input type="text" name="year" value="#form.year#">
            </td>
        </tr>
        <tr>
            <td></td>
            <td>
                <input type="text" name="month" value="#form.month#">
            </td>
        </tr>
        <tr>
            <td>休日</td>
            <td>
                <input type="text" name="holiday" value="#form.holiday#">
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <textarea name="data" cols="50" rows="10">#form.data#</textarea>
            </td>
        </tr>
    </table>
    <input type="submit" value="send">
    </form>
    </cfoutput>
    </cfsavecontent>

    <cfreturn local.tmp>
</cffunction>
<!---=================================================================
layout
==================================================================--->
<cffunction name="layout" returnType="void" output="yes">
    <cfargument name="content" type="string" required ="yes">

    <cfoutput>
    <!DOCTYPE HTML>
    <html lang="ja">
    <head>
        <meta charset="utf-8">
        <title>test</title>
    </head>
    <body>
    #arguments.content#
    </body>
    </html>
    </cfoutput>
</cffunction>

■monthtbl.cfc

<component>
    <cfset variables.year       = 0>
    <cfset variables.month      = 0>
    <cfset variables.lastDay    = 0>
    <cfset variables.listHoliday= "">
    <cfset variables.height     = 30>
    <cfset variables.width      = 25>
    <cfset variables.tbl        = arrayNew(2)>
    <cfset variables.aryDate    = arrayNew(1)>

    <!---===============================
    init
    ================================--->
    <cffunction name="init" returnType="monthtbl" output="no">
        <cfargument name="year"         type="string" required ="yes">
        <cfargument name="month"        type="string" required ="yes">
        <cfargument name="listHoliday"  type="string" required ="yes">

        <cfset var local = structNew()>
        <cfset variables.year       = arguments.year>
        <cfset variables.month      = arguments.month>
        <cfset variables.lastDay    = DaysInMonth(createDate(variables.year, variables.month, 1))>
        <cfset variables.listHoliday= arguments.listHoliday>

        <cfloop index="local.day" from="1" to="#variables.lastDay#">
            <cfloop index="local.hh" from="1" to="24">
                <cfset variables.tbl[local.day][local.hh] = "">
            </cfloop>
        </cfloop>

        <cfreturn this>
    </cffunction>

    <!---===============================
    chgDate
    ================================--->
    <cffunction name="chgDate" returnType="void" output="no">
        <cfset var local = structNew()>

        <cfloop index="local.idx" array="#variables.aryDate#">
            <cfset local.color  = ListFirst(local.idx, "|")>
            <cfset local.date   = ListLast(local.idx, "|")>
            <cfset local.from   = ListFirst(local.date, "-")>
            <cfset local.to     = ListLast(local.date, "-")>

            <!--- fromtoを元に配列にリスト形式で時間をセット --->
            <cftry>
                <cfset local.from = CreateDateTime(
                                                mid(local.from, 1, 4),
                                                mid(local.from, 5, 2),
                                                mid(local.from, 7, 2),
                                                mid(local.from, 9, 2),
                                                mid(local.from, 11, 2),
                                                0)>
                <cfset local.to = CreateDateTime(
                                                mid(local.to, 1, 4),
                                                mid(local.to, 5, 2),
                                                mid(local.to, 7, 2),
                                                mid(local.to, 9, 2),
                                                mid(local.to, 11, 2),
                                                0)>
                <cfloop index="local.idx2" from="#local.from#" to="#local.to#" step="#CreateTimeSpan(0,0,1,0)#">
                    <cfset local.year   = year(local.idx2)>
                    <cfset local.month  = month(local.idx2)>
                    <cfset local.day    = day(local.idx2)>
                    <cfset local.hour   = hour(local.idx2)>
                    <cfset local.Minute = Minute(local.idx2)>
                    <cfif (local.year eq variables.year) and (local.month eq variables.month)>
                        <cfset variables.tbl[local.day][local.hour + 1] = ListAppend(variables.tbl[local.day][local.hour + 1], "#local.color#-#local.Minute#")>
                    </cfif>
                </cfloop>

                <cfcatch>
                </cfcatch>
            </cftry>
        </cfloop>

        <!--- 配列内をdivタグに変換 --->
        <cfset chgDate2()>
    </cffunction>

    <!---===============================
    chgDate2
    ================================--->
    <cffunction name="chgDate2" returnType="void" output="no">
        <cfset var local = structNew()>

        <cfloop index="local.day" from="1" to="#variables.lastDay#">
            <cfloop index="local.hh" from="1" to="24">
                <cfif variables.tbl[local.day][local.hh] neq "">
                    <cfset variables.tbl[local.day][local.hh] = chgDate3(variables.tbl[local.day][local.hh])>
                </cfif>
            </cfloop>
        </cfloop>
    </cffunction>

    <!---===============================
    chgDate3
    ================================--->
    <cffunction name="chgDate3" returnType="string" output="no">
        <cfargument name="str" type="string" required ="yes">

        <cfset var local = structNew()>

        <!--- strを元に1から60の配列に色をセット --->
        <cfset local.aryMM = ArrayNew(1)>
        <cfloop index="local.idx" from="1" to="60">
            <cfset local.aryMM[local.idx] = "">
        </cfloop>
        <cfloop index="local.idx" list="#arguments.str#">
            <cfset local.color = ListFirst(local.idx, "-")>
            <cfset local.mm = ListLast(local.idx, "-")>
            <cfset local.aryMM[local.mm + 1] = local.color>
        </cfloop>

        <cfset local.ary = arrayNew(1)>
        <cfset local.color_old = local.aryMM[1]>
        <cfset local.cnt = 0>
        <cfloop index="local.idx" from="1" to="60">
            <cfset local.color = local.aryMM[local.idx]>
            <cfif local.color_old neq local.color>
                <cfset local.st = structNew()>
                <cfset local.st.color   = local.color_old>
                <cfset local.st.cnt     = local.cnt>
                <cfset ArrayAppend(local.ary, local.st)>

                <cfset local.color_old = local.color>
                <cfset local.cnt = 0>
            </cfif>
            <cfset local.cnt = local.cnt + 1>
        </cfloop>
        <cfset local.st = structNew()>
        <cfset local.st.color   = local.color_old>
        <cfset local.st.cnt     = local.cnt>
        <cfset ArrayAppend(local.ary, local.st)>

        <cfset local.data = "">
        <cfloop index="local.idx" array="#local.ary#">
            <cfset local.h = local.idx.cnt / 60 * 100>
            <cfset local.data = local.data & '<div style="height:#local.h#%;background-color:#local.idx.color#;">&nbsp;</div>'>
        </cfloop>

        <cfreturn local.data>
    </cffunction>

    <!---===============================
    dispTbl
    ================================--->
    <cffunction name="dispTbl" returnType="string" output="no">
        <cfset var local = structNew()>

        <cfsavecontent variable="local.tmp">
        <cfoutput>
        <style type="text/css">
        <!--
        table.monthtbl {
            border: solid 1px black;
            border-collapse: separate;
            border-spacing: 0px;
            }
        table.monthtbl .top, table.monthtbl .bottom , table.monthtbl .hh {
            padding:0;
            margin:0;
            height:#variables.height#px;
            width:#variables.width#px;
            border-left: solid 1px black;
            border-right: solid 1px black;
            text-align:center;
            vertical-align:middle;
            }
        table.monthtbl .hh {
            border-top:1px dashed black;
            }
        table.monthtbl .top {
            border-top:1px solid black;
            }
        table.monthtbl .bottom {
            border-bottom:1px solid black;
            }
        table.monthtbl .holiday {
            background-color:red;
            color:white;
            }
        -->
        </style>

        #variables.year##variables.month#<table class="monthtbl">
            <tr>
                <td class="hh top">&nbsp;</td>
                <cfloop index="local.day" from="1" to="#variables.lastDay#">
                    <cfset local.cls = "">
                    <cfif ListFind(variables.listHoliday, local.day)>
                        <cfset local.cls = "holiday">
                    </cfif>

                    <td class="hh top #local.cls#">#local.day#</td>
                </cfloop>
            </tr>

            <cfloop index="local.hh" from="0" to="23">
                <cfset local.cls = "">
                <cfif local.hh eq 0>
                    <cfset local.cls = "top">
                </cfif>
                <cfif local.hh eq 23>
                    <cfset local.cls = "bottom">
                </cfif>

                <tr>
                    <td class="hh #local.cls#">#local.hh#</td>

                    <cfloop index="local.day" from="1" to="#variables.lastDay#">
                        <td class="hh #local.cls#">#variables.tbl[local.day][local.hh + 1]#</td>
                    </cfloop>
                </tr>
            </cfloop>
        </table>
        </cfoutput>
        </cfsavecontent>

        <cfreturn local.tmp>
    </cffunction>

    <!---===============================
    setDate
    ================================--->
    <cffunction name="setDate" returnType="void" output="no">
        <cfargument name="fromtodate" type="string" required ="yes">

        <cfset ArrayAppend(variables.aryDate, arguments.fromtodate)>
    </cffunction>

    <!--- setter --->
    <!---===============================
    setHeight
    ================================--->
    <cffunction name="setHeight" returnType="void" output="no">
        <cfargument name="height" type="string" required ="yes">

        <cfset variables.height = arguments.height>
    </cffunction>
    <!---===============================
    setWidth
    ================================--->
    <cffunction name="setWidth" returnType="void" output="no">
        <cfargument name="width" type="string" required ="yes">

        <cfset variables.width = arguments.width>
    </cffunction>

</component>

2014-02-11

ColdFusionメール講座を始めました

ColdFusionに関する情報は、ほとんど見つかりません。

あったとしても、断片的なものばかり。

しかたがないので、自分でまとめてみました。

でも、すべてを網羅できていません(^^;

できる範囲でやってみました。

もしよろしければ、こちら からお願いします。

2012-11-21

[]Cookieを使ったメモと計算 JavaScript

元記事はこちらです。

■index.htm

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
<link rel="stylesheet" href="common.css" type="text/css" /> 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="common.js"></script>
</head>
<body>

<table>
    <tr>
        <td colspan="2">&nbsp;</td>
        <th>memo</th>
    </tr>
    <tr>
        <th>
            <input type="text" name="title1" id="title1" size="15" class="t_clr">
        </th>
        <td>
            <input type="text" name="u" id="u" size="10" maxlength="10" class="num">
        </td>
        <td>
            <input type="text" name="memo1" id="memo1" size="30">
        </td>
    </tr>
    <tr>
        <th>
            <input type="text" name="title2" id="title2" size="15" class="t_clr">
        </th>
        <td>
            <input type="text" name="r" id="r" size="10" maxlength="10" class="num">
        </td>
        <td>
            <input type="text" name="memo2" id="memo2" size="30">
        </td>
    </tr>
    <tr>
        <th>
            <input type="text" name="title3" id="title3" size="15" class="t_clr">
        </th>
        <td align="right" id="val3" class="dsp"></td>
        <td>
            <input type="text" name="memo3" id="memo3" size="30">
        </td>
    </tr>
    <tr>
        <th>
            <input type="text" name="title4" id="title4" size="15" class="t_clr">
        </th>
        <td>
            <input type="text" name="k" id="k" size="10" maxlength="10" class="num">
        </td>
        <td>
            <input type="text" name="memo4" id="memo4" size="30">
        </td>
    </tr>
    <tr>
        <th>
            <input type="text" name="title5" id="title5" size="15" class="t_clr">
        </th>
        <td align="right" id="val5" class="dsp"></td>
        <td>
            <input type="text" name="memo5" id="memo5" size="30">
        </td>
    </tr>
    <tr>
        <th>
            <input type="text" name="title6" id="title6" size="15" class="t_clr">
        </th>
        <td align="right" id="val6" class="dsp"></td>
        <td>
            <input type="text" name="memo6" id="memo6" size="30">
        </td>
    </tr>
</table>
<input type="button" value="CALC" id="calc">
</body>
</html>

common.css

input.num {
    text-align:right;
    }
input.t_clr {
    border: 0;
    background: lightskyblue;
    }
table {
    margin:5px 5px 0px 0px;
    padding:5px 5px 0px 5px;
    border: 1px black solid;
    border-collapse: collapse;
    border-spacing: 0;
    }
table th {
    white-space: nowrap;
    padding: 5px;
    border: black solid;
    border-width: 0 0 1px 1px;
    background: lightskyblue;
    font-weight: bold;
    line-height: 120%;
    text-align: center;
    }
table td {
    white-space: nowrap;
    background: white;
    padding: 5px;
    border: 1px black solid;
    border-width: 0 0 1px 1px;
    }

common.js

/*==================
初期化
==================*/
$(function () {
    $(":text").each(function() {
        a = getCookie(this.name);
        if(a===''){
            if((this.name==="u")||(this.name==="r")||(this.name==="k")){
                a = 0;
            }else{
                a = this.name;
            }
        }
        $(this).val(a);// input
    });

    $(".dsp").each(function() {
        a = getCookie(this.id);
        if(a===''){
            a = "0";
        }
        $(this).text(a); // td
    });

    $(".num").keyup(function(){
        js_keyChk(this);
    });

    $("#calc").click(function() {
        js_calc();
    });
});

function js_keyChk(obj) {
    var str = obj.value;
    var str2 = "";
    for(i=str.length;i--;) {
        if(str.charCodeAt(i) >= '0'.charCodeAt(0) && str.charCodeAt(i) <= '9'.charCodeAt(0)) {
            str2 = str.charAt(i) + str2;
        }
    }
    obj.value = str2;
}
function js_calc() {
    var mr = Math.ceil($("#r").val() / 10000) * 10000,
        ms = 0,
        m = 0,
        k = $("#k").val(),
        zan = 0,
        tmp = 0;

    zan = $("#u").val() - mr;

    if(zan > k) {
        tmp = zan - k;
        ms = Math.floor(tmp / 10000) * 10000;
    }
    $("#val3").text(addFigure(mr));
    $("#val5").text(addFigure(ms));
    $("#val6").text(addFigure(mr + ms));

    // cookieセット
    $(":text").each(function() {
        tmp = this.value;
        setCookie(this.name, tmp);
    });

    $(".dsp").each(function() {
        tmp = $(this).text();
        setCookie(this.id, tmp);
    });
}
/*====================================================================
http://www.tohoho-web.com/wwwcook3.htm
====================================================================*/
function getCookie(key,  tmp1, tmp2, xx1, xx2, xx3) {
    tmp1 = " " + document.cookie + ";";
    xx1 = xx2 = 0;
    len = tmp1.length;
    while (xx1 < len) {
        xx2 = tmp1.indexOf(";", xx1);
        tmp2 = tmp1.substring(xx1 + 1, xx2);
        xx3 = tmp2.indexOf("=");
        if (tmp2.substring(0, xx3) == key) {
            return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));
        }
        xx1 = xx2 + 1;
    }
    return("");
}
function setCookie(key, val, tmp) {
    tmp = key + "=" + escape(val) + "; ";
    // tmp += "path=" + location.pathname + "; ";
    tmp += "expires=Tue, 31-Dec-2030 23:59:59; ";
    document.cookie = tmp;
}
function clearCookie(key) {
    document.cookie = key + "=" + "xx; expires=Tue, 1-Jan-1980 00:00:00;";
}
/*====================================================================
数字を3桁区切りで表示する
http://sookibizviz.blog81.fc2.com/blog-entry-100.html
====================================================================*/
function addFigure(str) { 
    var num = new String(str).replace(/,/g, ""); 
    while(num != (num = num.replace(/^(-?\d+)(\d{3})/, "$1,$2"))); 
    return num; 
}

2012-11-20

[]Cookieを使ったメモと計算 ColdFusion

元記事はこちらです。

■Application.cfm

<cfsetting enableCFoutputOnly="yes">
<cfapplication name="#hash(GetDirectoryFromPath(GetCurrentTemplatePath()))#">

<cfset request.cookie_st = "t001">	<!--- 他のシステムとCookie変数がかぶらないようにするためのもの --->

■index.cfm

<cfset cst_exec()>
<!---=================================================================
cst_exec
    ※output="no"の場合、呼んだ関数で表示しても、表示されない
==================================================================--->
<cffunction name="cst_exec" returnType="void" output="yes">
    <cfset var local = structNew()>

    <!--- 変数セット --->
    <cfset cst_setValue("u", "0")>
    <cfset cst_setValue("r", "0")>
    <cfset cst_setValue("k", "0")>
    <cfloop index="local.idx" from="1" to="6">
        <cfset cst_setValue("title#local.idx#", "title#local.idx#")>
    </cfloop>
    <cfloop index="local.idx" from="1" to="6">
        <cfset cst_setValue("memo#local.idx#", "")>
    </cfloop>

    <cfset cst_dsp()>   <!--- 画面表示 --->
</cffunction>
<!---=================================================================
cst_dsp
==================================================================--->
<cffunction name="cst_dsp" returnType="void" output="yes">
    <cfset var local = structNew()>

    <cfoutput>
    <html>
    <head>
        <title>test</title>
    </head>
    <body>

    <script>
    <!--
    function js_keyChk(obj) {
        var str = obj.value;
        var str2 = "";
        for(i=str.length;i--;) {
            if(str.charCodeAt(i) >= '0'.charCodeAt(0) && str.charCodeAt(i) <= '9'.charCodeAt(0)) {
                str2 = str.charAt(i) + str2;
            }
        }
        obj.value = str2;
    }
    //-->
    </script>
    <style type="text/css">
    <!--
    input.num {
        text-align:right;
        }
    input.t_clr {
        border: 0;
        background: lightskyblue;
        }
    table {
        margin:5px 5px 0px 0px;
        padding:5px 5px 0px 5px;
        border: 1px black solid;
        border-collapse: collapse;
        border-spacing: 0;
        }
    table th {
        white-space: nowrap;
        padding: 5px;
        border: black solid;
        border-width: 0 0 1px 1px;
        background: lightskyblue;
        font-weight: bold;
        line-height: 120%;
        text-align: center;
        }
    table td {
        white-space: nowrap;
        background: white;
        padding: 5px;
        border: 1px black solid;
        border-width: 0 0 1px 1px;
        }
    //-->
    </style>

    <!--- 計算 --->
    <cfset local.mr = Ceiling(form.r / 10000)*10000>
    <cfset local.ms = 0>
    <cfset local.m = 0>
    <cfset local.zan = form.u - local.mr>
    <cfif local.zan gt form.k>
        <cfset local.tmp = local.zan - form.k>
        <cfset local.ms = int(local.tmp / 10000)*10000>
    </cfif>
    <cfset local.m = local.mr + local.ms>

    <form name="frm" action="#cgi.script_name#" method="post">
    <table>
        <tr>
            <td colspan="2">&nbsp;</td>
            <th>memo</th>
        </tr>
        <tr>
            <th>
                <input type="text" name="title1" size="15" class="t_clr" value="#form.title1#">
            </th>
            <td>
                <input type="text" name="u" size="10" maxlength="10" class="num" value="#form.u#"
                        onKeyup="js_keyChk(this)">
            </td>
            <td>
                <input type="text" name="memo1" size="30" value="#form.memo1#">
            </td>
        </tr>
        <tr>
            <th>
                <input type="text" name="title2" size="15" class="t_clr" value="#form.title2#">
            </th>
            <td>
                <input type="text" name="r" size="10" maxlength="10" class="num" value="#form.r#"
                        onKeyup="js_keyChk(this)">
            </td>
            <td>
                <input type="text" name="memo2" size="30" value="#form.memo2#">
            </td>
        </tr>
        <tr>
            <th>
                <input type="text" name="title3" size="15" class="t_clr" value="#form.title3#">
            </th>
            <td align="right">#numberformat(local.mr)#</td>
            <td>
                <input type="text" name="memo3" size="30" value="#form.memo3#">
            </td>
        </tr>
        <tr>
            <th>
                <input type="text" name="title4" size="15" class="t_clr" value="#form.title4#">
            </th>
            <td>
                <input type="text" name="k" size="10" maxlength="10" class="num" value="#form.k#"
                        onKeyup="js_keyChk(this)">
            </td>
            <td>
                <input type="text" name="memo4" size="30" value="#form.memo4#">
            </td>
        </tr>
        <tr>
            <th>
                <input type="text" name="title5" size="15" class="t_clr" value="#form.title5#">
            </th>
            <td align="right">#numberformat(local.ms)#</td>
            <td>
                <input type="text" name="memo5" size="30" value="#form.memo5#">
            </td>
        </tr>
        <tr>
            <th>
                <input type="text" name="title6" size="15" class="t_clr" value="#form.title6#">
            </th>
            <td align="right">#numberformat(local.m)#</td>
            <td>
                <input type="text" name="memo6" size="30" value="#form.memo6#">
            </td>
        </tr>
    </table>
    <input type="submit" value="CALC">
    </form>

    </body>
    </html>
    </cfoutput>
</cffunction>
<!---=================================================================
cst_setValue
    変数セット(form,cookie)
==================================================================--->
<cffunction name="cst_setValue" returnType="void" output="no">
    <cfargument name="v_nm" type="string" required ="yes">
    <cfargument name="def"  type="string" required ="yes">

    <!--- formがあった場合 --->
    <cfif StructKeyExists(form, arguments.v_nm)>
        <cfcookie name="#request.cookie_st#.#arguments.v_nm#" expires="never" value="#form[arguments.v_nm]#">
    <cfelse>
        <cfset form[arguments.v_nm] = arguments.def>
        <!--- cookieがあった場合 --->
<!--- NG cookieの配下には構造体はないらしい。ドットがはいったキー名
        <cfif StructKeyExists(cookie, request.cookie_st)>
            <cfif StructKeyExists(cookie[request.cookie_st], arguments.v_nm)>
                <cfset form[arguments.v_nm] = cookie[request.cookie_st][arguments.v_nm]>
            </cfif>
        </cfif>
--->
<!--- OK
        <cfif isDefined("cookie.#request.cookie_st#.#arguments.v_nm#")>
            <cfset form[arguments.v_nm] = evaluate("cookie.#request.cookie_st#.#arguments.v_nm#")>
        </cfif>
--->
        <!--- OK --->
        <cfif StructKeyExists(cookie, "#request.cookie_st#.#arguments.v_nm#")>
            <cfset form[arguments.v_nm] = cookie["#request.cookie_st#.#arguments.v_nm#"]>
        </cfif>

    </cfif>
</cffunction>

2012-10-25

[]ColdFusionで、[object object]って?

元記事はこちらです。

■Application.cfm

<cfsetting enableCFoutputOnly="yes">
<cfapplication name="#hash(GetDirectoryFromPath(GetCurrentTemplatePath()))#">

■index.cfm

<cfparam name="url.sts" default="">

<cfif (url.sts eq 1) or (url.sts eq 2)>
	<cfset cst_dsp()>
</cfif>
<!---=================================================================
cst_dsp
==================================================================--->
<cffunction name="cst_dsp" returnType="void" output="yes">
	<cfoutput>
	<html>
	<head>
		<title>test</title>
	</head>
	<body>

	<cfform form="html">
	<cfinput name="a"><br>
	<cfinput name="b" bind="cfc:test.getData#url.sts#({a@keyup})" readonly style="background:silver;">
	</cfform>
	</body>
	</html>
	</cfoutput>
</cffunction>

■test.cfc

<cfcomponent>
<cffunction name="getData1" access="remote">
	<cfargument name="id">

	<cfset var qry_tmp = getData(arguments.id)>
	<cfreturn qry_tmp>
</cffunction>
<cffunction name="getData2" access="remote">
	<cfargument name="id">

	<cfset var qry_tmp = getData(arguments.id)>
	<cfreturn qry_tmp.data>
</cffunction>
<cffunction name="getData">
	<cfargument name="id">

	<cfset var local = structNew()>
	<cfset var qry_tmp = makeData()>

	<cfquery name="qry_tmp" dbtype="query">
	select *
	from qry_tmp
	where id = '#arguments.id#'
	</cfquery>

	<cfreturn qry_tmp>
</cffunction>
<cffunction name="makeData">
	<cfset var qry_tmp = QueryNew("id,data","varchar,varchar")>
	<cfloop index="local.idx" from="1" to="10">
		<cfset QueryAddRow(qry_tmp)>
		<cfset local.id = right("00" & local.idx, 3)>
		<cfset QuerySetCell(qry_tmp, "id",  local.id)>
		<cfset QuerySetCell(qry_tmp, "data", local.id & "data")>
	</cfloop>

	<cfreturn qry_tmp>
</cffunction>
</cfcomponent>