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:183509 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
