• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Linking Array elements to WOComponents
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linking Array elements to WOComponents


  • Subject: Re: Linking Array elements to WOComponents
  • From: Sacha Mallais <email@hidden>
  • Date: Tue, 22 Mar 2005 09:21:01 -0800

On Mar 22, 2005, at 9:04 am, David LeBer wrote:

On Mar 22, 2005, at 11:46 AM, Jeffrey Schmitz wrote:

In the past I've searched many archives to the answer to what I thought would be a simple question, but I haven't been able to find an answer, or even a discussion of this topic. I have a java array of strings and I would like to be able to map individual elements of the array to individual WOString components on a web page. Up to now I've just been creating individual "pointers" that point to each array element and connecting those individual variables to my WOStrings, but there's gotta be a better way, doesn't there? I don't think I can use a WORepitition because I need each element to be displayed in a different place on the page, not in list like fashion which the WORepetition seems to force you into.

In short, is there a way to directly connect individual Java array elements to individual WOComponents.

How are you identifying the objects in the array? By position?

You could cache the values in a NSDictionary, giving each array object a name. Something like:

NSDictionary myDictionary;

public void createDictionary(NSArray array) {
	int count = array.count();
	NSMutableArray keys = new NSMutableArray();
	for (int i = 0; i < count; i++) {
		String key = "object" + i;
		keys.addObject(key);
	}
	myDictionary = new NSDictionary(array, keys);
}
		

Then bind to:

	myDictionary.object0, myDictonary.object1, etc.

You could also try WOgnl (part of project WOnder, but can be used independently).


sacha


-- Sacha Michel Mallais - 400 lb. chimp Global Village Consulting Inc.: http://www.global-village.net/ Choke on that, causality! -- the Professor, "Futurama"

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Linking Array elements to WOComponents (From: Jeffrey Schmitz <email@hidden>)
 >Re: Linking Array elements to WOComponents (From: David LeBer <email@hidden>)

  • Prev by Date: Re: WOMailDelivery question
  • Next by Date: Re: WOMailDelivery question
  • Previous by thread: Re: Linking Array elements to WOComponents
  • Next by thread: Re: Linking Array elements to WOComponents
  • Index(es):
    • Date
    • Thread