RE: JSP/Java in CF Page

2003-07-09 Thread Shahzad.Butt
There was no reason no following that approach. Its perfect and does
what I want.

Thanks

-Original Message-
From: Paul Hastings [mailto:[EMAIL PROTECTED] 
Sent: 08 July 2003 18:33
To: CF-Talk
Subject: Re: JSP/Java in CF Page


 First time writing Java/JSP code in CF. What should be the syntax to 
 include this java file in cf page and print results.

is there any reason for not taking this approach?

cfscript
 aSimpleDateFormat = createObject(java, java.text.SimpleDateFormat);
millseconds = javaCast(double,1057580739 * 1000);
thisDateMask=javaCast(string,/MM/dd HH:mm:ss);
thisDate=aSimpleDateFormat.init(thisDateMask).format(millseconds);
 writeoutput(#thisDate#);
/cfscript


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



JSP/Java in CF Page

2003-07-08 Thread Shahzad.Butt
Hi
 
First time writing Java/JSP code in CF. What should be the syntax to
include this java file in cf page and print results.
 
%@ import java.text.SimpleDateFormat;%
%@ import java.util.*;%
% public class formatDate{
public static void main(String args[]) {
 String seconds = args[0];
 long secs = Integer.parseInt(1057580739);
 long millseconds = secs * 1000;
 Date dateObj = new Date(millseconds);
 SimpleDateFormat sdf = new SimpleDateFormat(/MM/dd HH:mm:ss);
 String formattedDate = sdf.format(dateObj);
 System.out.println(formattedDate);
}
}
%
 
 
Shaz

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: JSP/Java in CF Page

2003-07-08 Thread webguy
CFSCRIPT
 GetPageContext().include(“hello.jsp”);
/CFSCRIPT

Full details here...
http://www.macromedia.com/devnet/mx/coldfusion/articles/java.html

WG

-Original Message-
From: Shahzad.Butt [mailto:[EMAIL PROTECTED]
Sent: 08 July 2003 10:14
To: CF-Talk
Subject: JSP/Java in CF Page


Hi

First time writing Java/JSP code in CF. What should be the syntax to
include this java file in cf page and print results.

%@ import java.text.SimpleDateFormat;%
%@ import java.util.*;%
% public class formatDate{
public static void main(String args[]) {
 String seconds = args[0];
 long secs = Integer.parseInt(1057580739);
 long millseconds = secs * 1000;
 Date dateObj = new Date(millseconds);
 SimpleDateFormat sdf = new SimpleDateFormat(/MM/dd HH:mm:ss);
 String formattedDate = sdf.format(dateObj);
 System.out.println(formattedDate);
}
}
%


Shaz


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: JSP/Java in CF Page

2003-07-08 Thread Shahzad.Butt
Getting this error

\u201cUTCDate, on line 9, column 31, is not a valid identifer name.  
The CFML compiler was processing:

an expression beginning with \u201cUTCDate.jsp\u201d, on line 9,
column 31.This message is usually caused by a problem in the expressions
structure.
an expression beginning with GetPageContext, on line 9, column 6.This
message is usually caused by a problem in the expressions structure.
a script statement beginning with GetPageContext on line 9, column 6.
a CFSCRIPT tag beginning on line 8, column 2.
 
  
The error occurred in C:\Test\UTC.cfm: line 9
 
7 : body
8 : CFSCRIPT
9 :  GetPageContext().include(UTCDate.jsp);
10 : /CFSCRIPT

 

-Original Message-
From: webguy [mailto:[EMAIL PROTECTED] 
Sent: 08 July 2003 11:46
To: CF-Talk
Subject: RE: JSP/Java in CF Page


CFSCRIPT
 GetPageContext().include(hello.jsp);
/CFSCRIPT

Full details here...
http://www.macromedia.com/devnet/mx/coldfusion/articles/java.html

WG

-Original Message-
From: Shahzad.Butt [mailto:[EMAIL PROTECTED]
Sent: 08 July 2003 10:14
To: CF-Talk
Subject: JSP/Java in CF Page


Hi

First time writing Java/JSP code in CF. What should be the syntax to
include this java file in cf page and print results.

%@ import java.text.SimpleDateFormat;%
%@ import java.util.*;%
% public class formatDate{
public static void main(String args[]) {
 String seconds = args[0];
 long secs = Integer.parseInt(1057580739);
 long millseconds = secs * 1000;
 Date dateObj = new Date(millseconds);
 SimpleDateFormat sdf = new SimpleDateFormat(/MM/dd HH:mm:ss);
String formattedDate = sdf.format(dateObj);
System.out.println(formattedDate);
}
}
%


Shaz



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

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

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: JSP/Java in CF Page

2003-07-08 Thread webguy
Looks like a unicode issue, what encoding are you using ?

WG

-Original Message-
From: Shahzad.Butt [mailto:[EMAIL PROTECTED]
Sent: 08 July 2003 13:10
To: CF-Talk
Subject: RE: JSP/Java in CF Page


Getting this error

\u201cUTCDate, on line 9, column 31, is not a valid identifer name.
The CFML compiler was processing:

an expression beginning with \u201cUTCDate.jsp\u201d, on line 9,
column 31.This message is usually caused by a problem in the expressions
structure.
an expression beginning with GetPageContext, on line 9, column 6.This
message is usually caused by a problem in the expressions structure.
a script statement beginning with GetPageContext on line 9, column 6.
a CFSCRIPT tag beginning on line 8, column 2.


The error occurred in C:\Test\UTC.cfm: line 9

7 : body
8 : CFSCRIPT
9 :  GetPageContext().include(UTCDate.jsp);
10 : /CFSCRIPT



-Original Message-
From: webguy [mailto:[EMAIL PROTECTED]
Sent: 08 July 2003 11:46
To: CF-Talk
Subject: RE: JSP/Java in CF Page


CFSCRIPT
 GetPageContext().include(hello.jsp);
/CFSCRIPT

Full details here...
http://www.macromedia.com/devnet/mx/coldfusion/articles/java.html

WG

-Original Message-
From: Shahzad.Butt [mailto:[EMAIL PROTECTED]
Sent: 08 July 2003 10:14
To: CF-Talk
Subject: JSP/Java in CF Page


Hi

First time writing Java/JSP code in CF. What should be the syntax to
include this java file in cf page and print results.

%@ import java.text.SimpleDateFormat;%
%@ import java.util.*;%
% public class formatDate{
public static void main(String args[]) {
 String seconds = args[0];
 long secs = Integer.parseInt(1057580739);
 long millseconds = secs * 1000;
 Date dateObj = new Date(millseconds);
 SimpleDateFormat sdf = new SimpleDateFormat(/MM/dd HH:mm:ss);
String formattedDate = sdf.format(dateObj);
System.out.println(formattedDate);
}
}
%


Shaz




~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: JSP/Java in CF Page

2003-07-08 Thread Shahzad.Butt
Default in Dreamweaver charset=iso-8859-1 I guess.

-Original Message-
From: webguy [mailto:[EMAIL PROTECTED] 
Sent: 08 July 2003 13:23
To: CF-Talk
Subject: RE: JSP/Java in CF Page


Looks like a unicode issue, what encoding are you using ?

WG

-Original Message-
From: Shahzad.Butt [mailto:[EMAIL PROTECTED]
Sent: 08 July 2003 13:10
To: CF-Talk
Subject: RE: JSP/Java in CF Page


Getting this error

\u201cUTCDate, on line 9, column 31, is not a valid identifer name.
The CFML compiler was processing:

an expression beginning with \u201cUTCDate.jsp\u201d, on line 9,
column 31.This message is usually caused by a problem in the expressions
structure. an expression beginning with GetPageContext, on line 9,
column 6.This message is usually caused by a problem in the expressions
structure. a script statement beginning with GetPageContext on line 9,
column 6. a CFSCRIPT tag beginning on line 8, column 2.


The error occurred in C:\Test\UTC.cfm: line 9

7 : body
8 : CFSCRIPT
9 :  GetPageContext().include(UTCDate.jsp);
10 : /CFSCRIPT



-Original Message-
From: webguy [mailto:[EMAIL PROTECTED]
Sent: 08 July 2003 11:46
To: CF-Talk
Subject: RE: JSP/Java in CF Page


CFSCRIPT
 GetPageContext().include(hello.jsp);
/CFSCRIPT

Full details here...
http://www.macromedia.com/devnet/mx/coldfusion/articles/java.html

WG

-Original Message-
From: Shahzad.Butt [mailto:[EMAIL PROTECTED]
Sent: 08 July 2003 10:14
To: CF-Talk
Subject: JSP/Java in CF Page


Hi

First time writing Java/JSP code in CF. What should be the syntax to
include this java file in cf page and print results.

%@ import java.text.SimpleDateFormat;%
%@ import java.util.*;%
% public class formatDate{
public static void main(String args[]) {
 String seconds = args[0];
 long secs = Integer.parseInt(1057580739);
 long millseconds = secs * 1000;
 Date dateObj = new Date(millseconds);
 SimpleDateFormat sdf = new SimpleDateFormat(/MM/dd HH:mm:ss);
String formattedDate = sdf.format(dateObj);
System.out.println(formattedDate);
}
}
%


Shaz





~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: JSP/Java in CF Page

2003-07-08 Thread webguy
\u201C is comma quotation mark, double turned  in unicode.

Maybe try this at the top of the page.

cfprocessingdirective encoding=utf-8

don't know anything about Dreamweaver

-Original Message-
From: Shahzad.Butt [mailto:[EMAIL PROTECTED]
Sent: 08 July 2003 13:30
To: CF-Talk
Subject: RE: JSP/Java in CF Page


Default in Dreamweaver charset=iso-8859-1 I guess.

-Original Message-
From: webguy [mailto:[EMAIL PROTECTED]
Sent: 08 July 2003 13:23
To: CF-Talk
Subject: RE: JSP/Java in CF Page


Looks like a unicode issue, what encoding are you using ?

WG

-Original Message-
From: Shahzad.Butt [mailto:[EMAIL PROTECTED]
Sent: 08 July 2003 13:10
To: CF-Talk
Subject: RE: JSP/Java in CF Page


Getting this error

\u201cUTCDate, on line 9, column 31, is not a valid identifer name.
The CFML compiler was processing:

an expression beginning with \u201cUTCDate.jsp\u201d, on line 9,
column 31.This message is usually caused by a problem in the expressions
structure. an expression beginning with GetPageContext, on line 9,
column 6.This message is usually caused by a problem in the expressions
structure. a script statement beginning with GetPageContext on line 9,
column 6. a CFSCRIPT tag beginning on line 8, column 2.


The error occurred in C:\Test\UTC.cfm: line 9

7 : body
8 : CFSCRIPT
9 :  GetPageContext().include(UTCDate.jsp);
10 : /CFSCRIPT



-Original Message-
From: webguy [mailto:[EMAIL PROTECTED]
Sent: 08 July 2003 11:46
To: CF-Talk
Subject: RE: JSP/Java in CF Page


CFSCRIPT
 GetPageContext().include(hello.jsp);
/CFSCRIPT

Full details here...
http://www.macromedia.com/devnet/mx/coldfusion/articles/java.html

WG

-Original Message-
From: Shahzad.Butt [mailto:[EMAIL PROTECTED]
Sent: 08 July 2003 10:14
To: CF-Talk
Subject: JSP/Java in CF Page


Hi

First time writing Java/JSP code in CF. What should be the syntax to
include this java file in cf page and print results.

%@ import java.text.SimpleDateFormat;%
%@ import java.util.*;%
% public class formatDate{
public static void main(String args[]) {
 String seconds = args[0];
 long secs = Integer.parseInt(1057580739);
 long millseconds = secs * 1000;
 Date dateObj = new Date(millseconds);
 SimpleDateFormat sdf = new SimpleDateFormat(/MM/dd HH:mm:ss);
String formattedDate = sdf.format(dateObj);
System.out.println(formattedDate);
}
}
%


Shaz






~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: JSP/Java in CF Page

2003-07-08 Thread Craig Dudley
You'd be better compiling the java to a class file, it's failry easy.

I posted this for tony yesterday after a suggestion made by webguy,
should be a final version, nice and quick and lets you specify the
dates' format.

The formats are java and can be found at 

http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html

Save the following as formatSecondsSinceEpoch.java ,compile it (javac
formatSecondsSinceEpoch.java) which should give you a
formatSecondsSinceEpoch.class file, stick this somewhere in CFMX's class
path and your'e good to go. You will of course need to download the JDK
from java.sun.com

---
import java.text.SimpleDateFormat;
import java.util.*;

public class formatSecondsSinceEpoch{
String seconds;
String format;
public final String formatDate(String seconds, String format){
long secs = Integer.parseInt(seconds);
long millseconds = secs * 1000;
Date dateObj = new Date(millseconds);
SimpleDateFormat sdf = new SimpleDateFormat(format); //
String formattedDate = sdf.format(dateObj);
return formattedDate;
}
}
---
cfscript
seconds = 1057580739;
format = /MM/dd HH:mm:ss;
mydate =  createobject('java','formatSecondsSinceEpoch');
ret  = mydate.formatDate(seconds,format);
/cfscript

cfoutput#ret#/cfoutput

cfloop from=1 to=500 index=i
cfset seconds = seconds + 1
cfset ret  =
mydate.formatDate(JavaCast(String,seconds),format) !--- Need to pass
in strings, so use JavaCast on the seconds if they are ints ---
cfoutput#ret#/cfoutputbr
/cfloop
---

-Original Message-
From: Shahzad.Butt [mailto:[EMAIL PROTECTED] 
Sent: 08 July 2003 13:30
To: CF-Talk
Subject: RE: JSP/Java in CF Page


Default in Dreamweaver charset=iso-8859-1 I guess.

-Original Message-
From: webguy [mailto:[EMAIL PROTECTED] 
Sent: 08 July 2003 13:23
To: CF-Talk
Subject: RE: JSP/Java in CF Page


Looks like a unicode issue, what encoding are you using ?

WG

-Original Message-
From: Shahzad.Butt [mailto:[EMAIL PROTECTED]
Sent: 08 July 2003 13:10
To: CF-Talk
Subject: RE: JSP/Java in CF Page


Getting this error

\u201cUTCDate, on line 9, column 31, is not a valid identifer name.
The CFML compiler was processing:

an expression beginning with \u201cUTCDate.jsp\u201d, on line 9,
column 31.This message is usually caused by a problem in the expressions
structure. an expression beginning with GetPageContext, on line 9,
column 6.This message is usually caused by a problem in the expressions
structure. a script statement beginning with GetPageContext on line 9,
column 6. a CFSCRIPT tag beginning on line 8, column 2.


The error occurred in C:\Test\UTC.cfm: line 9

7 : body
8 : CFSCRIPT
9 :  GetPageContext().include(UTCDate.jsp);
10 : /CFSCRIPT



-Original Message-
From: webguy [mailto:[EMAIL PROTECTED]
Sent: 08 July 2003 11:46
To: CF-Talk
Subject: RE: JSP/Java in CF Page


CFSCRIPT
 GetPageContext().include(hello.jsp);
/CFSCRIPT

Full details here...
http://www.macromedia.com/devnet/mx/coldfusion/articles/java.html

WG

-Original Message-
From: Shahzad.Butt [mailto:[EMAIL PROTECTED]
Sent: 08 July 2003 10:14
To: CF-Talk
Subject: JSP/Java in CF Page


Hi

First time writing Java/JSP code in CF. What should be the syntax to
include this java file in cf page and print results.

%@ import java.text.SimpleDateFormat;%
%@ import java.util.*;%
% public class formatDate{
public static void main(String args[]) {
 String seconds = args[0];
 long secs = Integer.parseInt(1057580739);
 long millseconds = secs * 1000;
 Date dateObj = new Date(millseconds);
 SimpleDateFormat sdf = new SimpleDateFormat(/MM/dd HH:mm:ss);
String formattedDate = sdf.format(dateObj);
System.out.println(formattedDate);
}
}
%


Shaz






~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



Re: JSP/Java in CF Page

2003-07-08 Thread Paul Hastings
 First time writing Java/JSP code in CF. What should be the syntax to
 include this java file in cf page and print results.

is there any reason for not taking this approach?

cfscript
 aSimpleDateFormat = createObject(java, java.text.SimpleDateFormat);
 millseconds = javaCast(double,1057580739 * 1000);
 thisDateMask=javaCast(string,/MM/dd HH:mm:ss);
 thisDate=aSimpleDateFormat.init(thisDateMask).format(millseconds);
 writeoutput(#thisDate#);
/cfscript

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

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

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4