Here's the entire code snippet...
<cfset wb =
createObject("java","org.apache.poi.hssf.usermodel.HSSFWorkbook").init()/>
<cfset fileOut =
createObject("java","java.io.FileOutputStream").init("#workbookpath#")/>
<cfset wb.write(fileOut)/>
<cfset fileOut.close()/>
On Wed, 18 Jan 2006 09:57:45 -0500
"Baz" <[EMAIL PROTECTED]> wrote:
> Hi Richard,
>
> To init() on create you need to make sure that the
>init() method returns THIS (<cfreturn this />) In your
>example it seems that you are returning VOID.
>
> Cheers,
> Baz
>
> -----Original Message-----
>From: Richard East [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 18, 2006 8:36 AM
> To: CF-Talk
> Subject: Using CreateObject with init correctly
>
> I have seen code where an object was created like this:
> <cfset userInfo=CreateObject("component",
>"objects.player").init(REQUEST.id) />
>
> The method I had been using that works is like this:
> <cfset REQUEST.id = 1 />
> <cfset userInfo=CreateObject("component",
>"objects.player") />
> <cfset userInfo.init(datasource) />
> <cfset REQUEST.qryUserDetails =
>userInfo.getUserDetails(REQUEST.id) />
> <cfdump var="#REQUEST.qryUserDetails#"><cfabort />
>
> I have tried the method of initiating the Object as it
>is created, but when I do I get an error:
>
> <cfset userInfo=CreateObject("component",
>"objects.player").init(REQUEST.id) />
> <cfset REQUEST.qryUserDetails =
>userInfo.getUserDetails(REQUEST.id) />
> <cfdump var="#REQUEST.qryUserDetails#"><cfabort />
>
> This fails with the error message, ââ¬ÅVariable
>userInfo is undefined.ââ¬Ã? Would someone clarify how I
>can do this correctly and what would be best practice?
>
> Thank you for your help and opinions,
>
> Richard
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:229892
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54