Well exactly that way rowObject.arrDays[i]

The only things that I see as a possible hick up are one or more of the
following:

   - Looks like you may be (rowObject.daysArr[i] = entry.timespan;) using
   = as an equality operator? Its hard to tell from the ammount of code
   provided, but = is an assignment operator ( for setting x = y ) and == is
   the equality operator (testing to see if x==y).
   - Java Arrays are zero based, so in your example, arrDays[i] (where i
   = 1
   for example) = sunday would is incorrect. It would be Monday (actually
   "mon"). I'm not sure if you were just using this as an example or whether or
   not you were actually getting "mon" back in your scenario and expectin
   "sun". So I wrote this just in case.
   - Same thing with java being zero based you should be looping from 0
   to 6.


On 11/22/05, Greg Morphis <[EMAIL PROTECTED]> wrote:
>
> I'm using a for loop already, looping over i..
> I just don't know how to make java see that arrDays[i] (where i = 1
> for example) = sunday.
> I know in CF, you can use the eval() function or dot notation
> form.["name"] = "Foo"
> but not sure how to do this in Java.
> The array of arrDays is declared locally in the .jsp page.
> The WeeklyRowObject is public, though.
>
> On 11/21/05, Chris Stoner <[EMAIL PROTECTED]> wrote:
> > First guess based on what you have shown (assuming that the daysArr is
> > private) would be to create a getByIndex method in your WeelkyRowObject
> that
> > takes the value of i and retrieves the date from its embeded array and
> > returns it.
> >
> > Also if the daysArr is private, you might want to create an iterator to
> loop
> > over the array (
> > http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html) to
> abstract
> > this. I say might because iterators are not as fast as for loops over an
> > array, but allow for better encapsulation.
> >
> > Take this with a grain of salt because I am not a java developer but
> have
> > been to a few courses on the subject.
> >
> > On 11/21/05, Greg Morphis <[EMAIL PROTECTED]> wrote:
> > >
> > > I have an array
> > > String daysArr[] = {"sun", "mon", "tue", "wed", "thur", "fri", "sat"};
> > >
> > > then a for loop looping over a variable i, from 1 to 7..
> > >
> > > I have a class called WeeklyRowObject with the days in it, sun - sat..
> > > I can say rowObject.sun = entry.timespan;
> > > but how would I use that array of days to do it dynamically?
> > > Something like
> > > rowObject.daysArr[i] = entry.timespan;
> > >
> > > Anyone know?
> > >
> > > Thanks in advance!
> > >
> > >
> > > --
> > > Auxilium meum a Domino
> > >
> > >
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:5:183539
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/5
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:5
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to