November 12, 2008

Developing ColdFusion Extensions in Java

To make this short and effective:

1. You cannot reload CFX developed in Java without server restart. Empirically proven and confirmed by other CF developers (as some ppl claim, even by Adobe tech support)
ref: http://dreamweaverforum.info/advanced-techniques/78901-how-reload-java-cfx-without-restarting-coldfusion.html

2. Article to read to get into this subject fast and "good enough"
http://www.intermedia.net/support/coldfusion/cf5docs/Developing_ColdFusion_Applications/CFXTags4.html

3. Example
import com.allaire.cfx.*;

public class test implements CustomTag {

public void processRequest(Request request, Response response) throws Exception {
// TODO Auto-generated method stub
String strName = request.getAttribute( "NAME" );
response.write( "Cao, " + strName );

Query qr = request.getQuery();

if ( qr == null )
{
throw new Exception(
"Missing QUERY parameter. " +
"You must pass a QUERY parameter in "+
"order for this tag to work correctly." ) ;
}

int i=1,j=1;
while(i<=qr.getRowCount()){ j=1; response.write(" "); while(j<=qr.getColumns().length){ response.write(qr.getData(i, j)+" | "); j++; } i++; } } }


Voila! Now you know everything :)))

No comments: