Thanks! will let you know how it goes. I have really been seeing the usefulness of using Java with CF lately.
~~
Stephenie

>I reckon you'll be needing a Java CFX then.
>
>Seemed like a fun 5 minute project so here ya go.....
>
>-----------------
>
>import com.allaire.cfx.*;
>import java.io.*;
>
>public class cfReadTxtFile implements CustomTag{
>   public void processRequest( Request request, Response response )
>throws Exception
>   {
>  if ( !request.attributeExists("filename") ||
>!request.attributeExists("variable") )
>  {
>     throw new Exception("Missing attributes, filename and variable are
>required.");
>  }
>
>  String filename = request.getAttribute( "filename" );
>  String variable = request.getAttribute( "variable" );
>  
>  String fileContent = "";
>  
>     try {
>         BufferedReader in = new BufferedReader(new
>FileReader(filename));
>         String str;
>         while ((str = in.readLine()) != null) {
>             fileContent = fileContent + str +
>System.getProperty("line.separator");
>         }
>         in.close();
>     } catch (IOException e) {
>     }  
>  
>  response.setVariable( variable, fileContent);
>  
> }
>}
>
>-------------------
>
>Call it like so...
>
><cfx_cfReadTxtFile filename="d:\sites\test\string.cfm" variable="test">
>
><cfdump var="#test#">
>
>Tested and works perfectly on CF5
>
>I'll mail you the source and the compiled CFX off list aswell.
>
>Craig.
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to