> Thanks for the reply, appreciate it. From what I understand, I have to > do something like : > > firstList --eachElementIs--> simpleBean --contains--> secondList > > In other words, wrap the 2nd list inside a bean. However, if that's the > cast, I would imagine it will drag down the performance of our > application by quite a bit due to Objects instantiation. (the 2D > collection get used a lot and the collections are quite large). Is > there anyway around it so that I can still use the original data > structure ? > > Again, thanks for the input. :)
If performance is that much of an issue, I'd square up the use of the lists. If it's all random acces (like accessing through the BeanUtils system) then ArrayLists are sweet, but if your processing is running through linearly then the LinkedList is the better bet. Just thought I'd mention it. As for the problem at hand... there's not all that much you can do really. One option, if you know that the model is thread safe (like, only one user will be on it at a time ie: request scope/everything but application scope), then you can "fake" it by making a bean that turns in on itself. By this I mean to make a bean that holds these multi-dimensioned arrays and takes note of the indexes requested. When the child array is sought after, return a reference to itself noting the index. The child index will come in, do the same, store the index and then return the same object. Throw in an extra stage (using the nested:property tag to put in a "fake" level). We know that when this is called it needs a real object, from which you can offer up the multi-dimmed object. eg:... <start crappy code> private int parentIndex; private int childIndex; private ArrayList myData; public Object getParentList(int i) { this.parentIndex = i; return this; } public Object getChildList(int i) { this.childIndex = i; return this; } public Object getFakeProperty() { return ((ArrayList)myData.get(parentIndex)).get(childIndex); } </end crappy code> ...catch my drift? I've done a fake properties like this, and they work sweet. I haven't done it for two sequential lists, but the theory is sound. It's the fake property brings it all back together telling the object that it has to pull its finger out and actually fetch the object you're after. The above will remove the overhead of all the object creation. It has to be thread safe because if another thread gets in there inbetween a thread reading the first index and the second, it'll all be out of whack. If the list is build for a particular user, there shouldn't be any issues. ...explanation fuzzy at all?... outside of this, there's no option that comes to mind. Note: if you want to access a property of the object of the first list (the bean theoretically holding the other list), you'll have to make another fake property to identify you want that object. eg: public Object getFirstLevelFake() { return (ArrayList)myData.get(parentIndex); } ...outside of all the stuff spieled on above, ie: once you've broken through that second list or have reference to the parent list object, you can keep nesting as usual. Hopefully I've said all that clear enough for you to move forward :) Arron. -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>