Re: Linking Array elements to WOComponents
Re: Linking Array elements to WOComponents
- Subject: Re: Linking Array elements to WOComponents
- From: Jeffrey Schmitz <email@hidden>
- Date: Tue, 22 Mar 2005 12:26:58 -0700
So what is it that you then map to your WO componenet? i.e. what do you put in your wod file for each of the WOString elements?
I guess I'm surprised the wod files don't handle this better and let you put something like (I don't have the syntax of the wod files quite memorized):
...
MyString3 : WOString
value = myStrings[2];
end
MyString4 : WOString
value = myStrings[3];
end
...
Seems like it would be a simple and very useful thing to be able to do. I was thinking there must be something I'm missing, or some special syntax that I just didn't know, but sounds like there's no straightforward solution to what I thought would be a very simple problem.
On Tuesday, March 22, 2005, at 11:46AM, Arturo Perez <email@hidden> wrote:
>David LeBer wrote:
>
>> On Mar 22, 2005, at 11:46 AM, Jeffrey Schmitz wrote:
>>
>>> 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. ...
>>>
>>> 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?
>>
>
>(The following is offered in the vein of a hack from someone who likes
>formatters.)
>
>How about using a formatter? Set the value of the string to the index
>and do something like
>
>class hackArrayOfStrings extends java.text.Format {
> private [] String arrayOfStrings;
>
> public StringBuffer format(Object o,
> StringBuffer sb,
> ParsePosition pp) {
> int idxOfString = Integer.intValue(o.toString());
> sb.append(arrayOFStrings[idxOfString]);
> return sb;
> }
>
> public void setArrayOfStrings(String [] x) {
> arrayOfStrings = x;
> }
>}
>
>
>
>
_______________________________________________
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