I feel this code belongs in your Action class (or any web tier class or even business tier), not
JSP.
Create an aggregate collection and then let the JSP just iterate over it and display.
Srikanth
Author: Struts Survival Guide - Basics to Best Practices