DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=33190>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=33190 Summary: Facility for passing an Iterator object into the 'View' part of an MVC framework Product: Commons Version: unspecified Platform: PC OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Collections AssignedTo: commons-dev@jakarta.apache.org ReportedBy: [EMAIL PROTECTED] Note that this enhancement is not Struts/OJB/etc specific: I'm just using this as an example that I believe will be easy for people to relate to. Generally stated, I'm proposing a special Iterator implementation that will automatically close resources at the end of the iteration. If you're using an MVC framework like Struts or Spring, there's a frequent need to pass Iterator objects into the request scope so that a JSP in the View can loop over the Iterator and, for example, print out some values. If you are reading a large number of records from a DB, you could create a copy of the Collection in your Action class and pass an Iterator through by dropping it into the request. A better approach that requires less memory is one which would allow you to pass an Iterator object that performs lazy initialization, since this is more efficient in terms of memory use. However, because the View and the Controller are seperate layers, you would need to close your database connection before forwarding the request to the JSP. Since, in Struts, your Action class's execute() method has already terminated at this time, you're left with ugly hacks like using scriptlet code to call close() on certain objects. The approach that I'm proposing here is one which I picked up off of the OJB user list a while ago. I've implemented a special Iterator() that calls close() on an resource object when there are no more elements in the iteration. -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]