Hello! New to this list - in the hopes that I can find some advice for a tricky problem that I am facing:
Problem: I need to use CFOBJECT to instantiate a Java class and then run a few of its methods. The methods require an array be passed in as a parameter when called. Normally, in Java, you would do something like this: String[] blob = new String[1]; blob[0] = "original text"; WebContextor mcontextor = new WebContextor(); mcontextor.run(blob); out.println(blob); * Output would be "Some New Altered Text" As you can see, there is no return value for the run() method. Inside the run() method the blob array is altered but it is not returned by the method, instead, the blob is somehow automatically 'passed by reference' by Java into the method and the new altered value is now available to the rest of the code in the main body upon return. When I use CFOBJECT to create the WebContextor class and call the run() method, passing a CF array[], the values in the array are apparently 'passed by value' to the method. A copy is made of the array when it is passed to run() so when I return from run() the original CF array has not been altered and the new altered value is not available to the rest of the CF code. <cfobject action="create" type="java" class="WebContextor" name="mcontextor"> <cfset blob = arrayNew(1)> <cfset blob[1]="original text"> <cfset mcontextor.run(blob)> <cfoutput>#blob[1]#</cfoutput> Output is "original text" - the contents of the array within this CF page apparently has not been altered. I realize that there may be ways around this by creating and calling custom tags that, in turn, call the WebContextor, however, I would like to know if anyone knows of a way to achieve this without using a custom tag. I keep thinking that instead of passing a CF array to the run() method I should first create a new Java Array CFOBJECT that can store the CF array, and when the CFOBJECT WebContextor is instanced and it's run() method called, the Java Array can be passed instead of the CF array. Maybe that will cause it to be passed by reference instead of by value? I am currently on CF Enterprise server 4.5 but have a new copy of MX Enterprise sitting on my desk. Don't know if anything along these lines has changed in MX or if this is something I can already do in 4.5 but any help at all would be tremendously appreciated !!!! Thanks, Darren Houle Sr. Web Developer Health First, Inc. "MMS <health-first.org>" made the following annotations on 06/18/02 14:39:22 ------------------------------------------------------------------------------ This message is for the named person's use only. It may contain confidential, proprietary, or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it, and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. Health First reserves the right to monitor all e-mail communications through its networks. Any views or opinions expressed in this message are solely those of the individual sender, except (1) where the message states such views or opinions are on behalf of a particular entity; and (2) the sender is authorized by the entity to give such views or opinions. ============================================================================== ______________________________________________________________________ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

