This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Struts and the fly likes Problem with 2 collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with 2 collection" Watch "Problem with 2 collection" New topic

Problem with 2 collection

S Venkatesh
Ranch Hand

Joined: Jun 27, 2005
Posts: 464

Hi All,

I have 2 collections.
First collection is a collection of Schedule with following attributes.
Schedule = {schedule_id,job_id,client_id}
Another collection is a collection of Job with the following attributes.
Job = {job_id,job_name}

Now in the schedule list page i want to display the job_name for the corresponding job_id of the Schedule in the first collection

that is my list page is as follows

ScheduleName JobName
<name> <name>

How do i accomplish this using struts tag-libs in my JSP.

Venkatesh S
Dom Lassy
Ranch Hand

Joined: May 05, 2006
Posts: 181
Ideally, you should populate your bean in your action to contain the necessary information without having to cross reference the two lists in the jsp. For example, your bean can be a collection of ScheduleJobClient POJO DTOs that looks like this:

That way you can iterate over the ScheduleJobClient list in your bean and display the job name for each schedule.
S Venkatesh
Ranch Hand

Joined: Jun 27, 2005
Posts: 464

Thank you very much. I did the same Its working perfectly now.
Have you checked out Aspose?
subject: Problem with 2 collection
It's not a secret anymore!