Solved

Usnig Java Interfaces in ColdFusion

Posted on 2008-09-30
1
249 Views
Last Modified: 2013-12-24
Below i my attempt to use the java interface java.util.Enumeration.  Because it is an interface and cannot be instantiated the code fails with the error:

Unable to find a constructor for class java.util.Enumeration that accepts parameters of type ( '' ).


How do I correct this.
If (IsDefined('URL.oid') and IsDefined('URL.crgid')) {

	if (Not IsDefined('Session.HtCreativeGroups')){

		ht = createObject('java','java.util.Hashtable').init();

		Session.HtCreativeGroups = ht;

	}

	Session.HtCreativeGroups.put(URL.oid, URL.crgid);

	keys = createObject('java','java.util.Enumeration').init();

	keys = Session.HtCreativeGroups.keys();

	while ( keys.hasMoreElements() )

 			{ 

 				key =  JavaCast("keys.nextElement()", String);

 				creativeGroup =  JavaCast("Session.HtCreativeGroups.get(key)", String);

 				writeOutput( key & " " & creativeGroups );

 				writeOutput("<BR>");

 			} 

	

}

Open in new window

0
Comment
Question by:onaled777
1 Comment
 

Accepted Solution

by:
onaled777 earned 0 total points
Comment Utility
Solution Below:
		If (IsDefined('URL.oid') and IsDefined('URL.crgid')) {

			if (Not IsDefined('Session.HtCreativeGroups')){

				ht = createObject('java','java.util.Hashtable').init();

				Session.HtCreativeGroups = ht;

			}

			Session.HtCreativeGroups.put(URL.oid, URL.crgid);

			keys = Session.HtCreativeGroups.keys();

			while ( keys.hasMoreElements() )

   			{ 

   				key = keys.nextElement();

   				creativeGroup =  Session.HtCreativeGroups.get(key);

   				writeOutput( key & " " & creativeGroup );

   				writeOutput("<BR>");

   			} 

			

		}

Open in new window

0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now