You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by andy wix <st...@hotmail.com> on 2005/05/18 12:10:17 UTC

Slightly OT: Complex data output

Hi,

I am trying to output a many-to-many mapping using JSTL or Struts tags.

My app will manage a user authorization database and so has a table of 
Applications, Roles, Users and a link table.  For each Application there can 
be many Roles, and for each Role there can be many Users.

The data model I have come up with is:

There is one outer map and one to many inner maps.
The outer map's keys are Applications.
The outer map's values are inner maps.
The inner map's keys are Roles.
The inner map's values are Arraylists of Users for each Role.

The issue is that I can't just output these values as an html table because 
I don't know the number of Users per Role or the number of Roles per App 
until I iterate over the map and so I can't set the rowspan element for, 
say, Applications.

Is there a standard approach for this type of problem or does the answer lie 
in the data model?  I suppose the alternative is to have a 'Result' object 
that has an Application object, a Role object and a User object and output 
these objects with some logic in the JSP page to ensure that, say, 
Application X gets listed once only.

Thanks,
Andy

_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free newsletters! 
http://www.msn.co.uk/newsletters


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org