Using cfscript to invoke components.

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Using cfscript to invoke components.

    I was wondering, if I use cfscript to invoke a coldfusion component, does it reinvoke the entire component when more than 1 method is called?
    superbullet Guest

  2. Similar Questions and Discussions

    1. Cftry and cfscript..hmmm
      I want to catch errors in cfscript as I did with cftags, where the code is inside the cftry and if an error occurs, then the error is supressed, and...
    2. cfscript
      since i cannot find the cf and java integration thread, gues i will post this here: i wrote a cfm with cfscript that utilizes java which connects...
    3. <cfscript> autocaps problem </cfscript> - betcha can't fix this!
      First, I'll tell you up front that I am clueless when it comes to cfscript. So I apologize if this question is off topic. I have a nice little...
    4. cfscript and variables
      I'm using cfscript against a COM object. In VB the paramater is passed like: Set oSegment = oTransactionset.CreateDataSegment('BEG')...
    5. vbscript to cfscript
      I'm trying to assign a value to an object. I have an example in asp that works and I'm trying to get it to work in cfscript. Here's the vbscript: ...
  3. #2

    Default Re: Using cfscript to invoke components.

    If you invoke your component as a object then all its public methods will be
    available for the rest of the template.

    eg.

    <cfscript>
    // create component object
    compObj = CreateObject("component", "myCFC");

    // call init method
    compObj.init(var1);

    // call init method again
    compObj.init(var2);
    </cfscript>

    you can also create objects in the session scope and you can then call methods
    from that for the life of the session.

    Stressed_Simon Guest

  4. #3

    Default Re: Using cfscript to invoke components.

    That was my guess as well. But if you use <cfinvoke> then inorder to call a second method the entire component must be reinvoked right? So cfscript has an advantage.
    superbullet Guest

  5. #4

    Default Re: Using cfscript to invoke components.

    On 2005-06-26 15:01:58 -0500, "superbullet"
    <webforumsuser@macromedia.com> said:
    > That was my guess as well. But if you use <cfinvoke> then inorder to
    > call a second method the entire component must be reinvoked right? So
    > cfscript has an advantage.
    It's not cfscript that has an advantage so much as using cfobject or
    CreateObject() as opposed to cfinvoke creates the advantage you
    describe. You can use cfobject to instantiate your object and then
    call multiple methods on it, and this would be more or less the same as
    using CreateObject() in cfscript.

    Matt
    --
    Matt Woodward
    [email]mpwoodward@gmail.com[/email]
    Team Macromedia - ColdFusion

    mpwoodward *TMM* Guest

  6. #5

    Default Re: Using cfscript to invoke components.

    Yes, that's what I meant. I just always use cfscript, and I forget that <cfobject> tag exists. Well, then that is strange, why did they ever even come up with a <cfinvoke> tag?
    superbullet Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139