Re: Next Hurdle.....
Re: Next Hurdle.....
- Subject: Re: Next Hurdle.....
- From: Paul Lynch <email@hidden>
- Date: Sun, 2 Apr 2006 22:38:04 +0100
I'll skip over the questions of why you are using something called
"functions", and why you think you need an NSMutableArray - both seem
to indicate something not quite following the tao. Instead, I'll
answer the question you asked.
You need to use a WORepetition wrapped around a row in your table -
if you use WebObjects Builder, it will create exactly such a
structure when you insert a table into your page component. The
WORepetition needs two bindings - a list, which will be your array;
and an item. The item is an instance variable that is used as a
working object while building up all the rows in your table; it
should be of a type that represents the objects in your array - most
often this will be EOEnterpriseObject, EOGenericRecord, or a custom
class or Enterprise Object of your own; possibly even an NSDictionary.
Within the row, bind to values of your item object. eg:
NSArray array;
EOEnterpriseObject item;
<table>
<webobject name=MyRepetition>
<tr><td><webobject name=StringInRow></webobject></td</tr>
</webobject>
<table>
MyRepetition: WORepetition {
list = array;
item = item;
}
StringInRow: WOString {
value = item.name;
}
(I typed it in, not my fault)
You need to read a basic intro text to WebObjects, this is all
covered in great detail in several different books and on-line refs.
Paul
On 2 Apr 2006, at 22:16, Jeffrey Pearson wrote:
Thanks to all of you, I have gotten quite far in my app. Thank you
again all of you.
OK. Next hurdle.
My existing jsp app pulls data from a MySQL database and populates
an ArrayList of those objects. I figured out from the WebObjects
for Windows Developers docs that I needed to change the object to
NSMutableArray. So I added the NSMutableArray to my page object. In
the page constructor, I called the method to create the Array. ie:
public class Publishers extends WOComponent {
protected NSMutableArray allPublishers;
/** @TypeInfo Publishers */
public Publishers(WOContext context) {
super(context);
PublisherFunctions pf = new com.metrohero.web.PublisherFunctions();
allPublishers = pf.getAllPublishers();
}
}
I see the allPublishers in WOBuilder. I can even bind a string to
allPublishers.count. Now how to I get to the last part of binding a
table to the array of objects?
_______________________________________________
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