If you know your way around Java, then using it within CF is a snap.
Basically, it's all exactly the same, except for constructors:

Java:
-----
Socket s = new Socket("10.10.1.1", 80);
....
s.close();

ColdFusion (CFSCRIPT):
----------------------
s = createObject("java", "java.net.Socket");
s.init("10.10.1.1", 80);
....
s.close();

You may need to use javaCast() for some parameters.  For example, CF doesn't
know what an int is (it only uses double), so you sometimes have to
explicitly use javaCast for int parameters.

You can also use CF tags (CFOBJECT, CFINVOKE) to do all that stuff, but I
don't know the syntax, because I always use CFSCRIPT or CFSET to do
everything.

Cheers,
barneyb

> -----Original Message-----
> From: Michael Wolfe [mailto:[EMAIL PROTECTED]
> Sent: Monday, January 26, 2004 1:19 PM
> To: CF-Talk
> Subject: RE: Java for ColdFusion Developers
>
> Hi Massimo,
>  
> First, let me say that I'm not a Java newbie... What I'm
> looking for is a
> book that gives specific examples of how to integrate Java in
> my existing CF
> code.
>  
> Specifically, I'm working on an app that checks IP addresses
> against DNSBL
> lists. I know that I can do this using a CFX tag, but I would
> rather do it
> using java.net.Socket, for both performance and reliability reasons.
>  
>  
>
> --
>
> Michael Wolfe
>
> [EMAIL PROTECTED]
>
>  
>
>
>
>
>   _____  
>
> From: Massimo, Tiziana e Federica [mailto:[EMAIL PROTECTED]
> Sent: Monday, January 26, 2004 1:02 PM
> To: CF-Talk
> Subject: Re: Java for ColdFusion Developers
>
>
> > Java for ColdFusion Developers
> > by Eben Hewitt
> > http://www.amazon.com/exec/obidos/ASIN/0130461806
> >
> > I'm looking for a book that gives the nuts-n-bolts of using
> Java from
> > within ColdFusion, and this one has several good reviews on Amazon.
>
> I think it's an excellent book (I wrote one of those
> reviews). But it's more
> about introducing Java to CF developers than using Java from CF.
>
> What exactely are you looking for?
>
> ----------------------------
> Massimo Foti
> http://www.massimocorner.com
>
> Co-Author of Dreamweaver MX 2004 Magic:
> http://www.dwmagic.com/
>
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to