• 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
Binding WOString to method with parameters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Binding WOString to method with parameters


  • Subject: Binding WOString to method with parameters
  • From: Randall Cayford <email@hidden>
  • Date: Thu, 25 Mar 2004 20:33:40 -0800

I'm new to webobjects so this may turn out to be a case of completely misusing the tool but I'm baffled.

I have a table with 5 cells. In each of these cells I would like to put a WOString which displays a number from one of my java classes. I could define a set of 5 functions and bind each WOString to a different function but that just seems wrong to me.

So I would like to bind the WOString to a function which takes an argument. So I would have something in my page class like:

int getSpeed(int lane) {
   return(speed[lane]);
}

which returns the correct value for each cell depending on the value of lane.

So, is there any way to bind a WOString to a function with arguments? My naive attempt simply causes a failure to match any function, presumably because the signature is wrong.

If I can bind to a function with arguments, where and how do I get the arguments set and passed to the function?

If I can't do functions with arguments, I could have a class instance variable instead:

int currentLane;
int getSpeed() {
   return(speed[currentLane]);
}

But then how do I wrap the WOString in something which allows me to set the currentLane variable for the particular cell?

I could even put the cells in a WORepetition which loops from 1 to 5 but then how do I get a repetition to loop through a count instead of a list of objects and how do I set the instance variable to the repetition count?

I suspect I am either missing some basic understanding of how things are bound to components or I'm just supposed to turn everything into objects and lists of objects even if that means creating a ton of Integer objects just to hold counters. Or maybe I really do have to define a ton of little functions like getSpeed1(), getSpeed2(), etc.

I've spent more than a few hours looking for tutorials or explanations but haven't found anything that I could work with.

Thanks for any enlightenment anyone can pass on.

Randall


============= Randall Cayford Institute of Transportation Studies University of California, Berkeley _______________________________________________ webobjects-dev mailing list | email@hidden Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Binding WOString to method with parameters
      • From: Arturo PĂ©rez <email@hidden>
    • Re: Binding WOString to method with parameters
      • From: Art Isbell <email@hidden>
  • Prev by Date: Re: eo_pk_table
  • Next by Date: Re: Binding WOString to method with parameters
  • Previous by thread: Re: Seeing SQL
  • Next by thread: Re: Binding WOString to method with parameters
  • Index(es):
    • Date
    • Thread