• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Presentation Layer Design question to display multi header / detail html tables

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all.. I've having a little bit of a design problem ultimately my html needs to appear like this. (please excuse any formatting problems)

Html Header Table 1
Col1 Col 2 Col 3
Html Detail Table 2
Col 1 Col 2 Col 3
Col 1 Col 2 Col 3
etc..etc.
Html Header Table 2 (Chile of Parent Table 1
Col 1 Col 2 Col 3
Html Detail Table 2
Col 1 Col 2 Col 3
etc.etc. to the 4th level.

So basically there are 4 levels of data with the html being indented to the right.

Currently I'm using Struts / an Arraylist of Plain Old Java Beans returned back to my JSP. in the JSP i'm iterating through the arraylist with the struts itereate tag lib.. my issue. is to how to perform control breaking / grouping with multiple levels of data.. ie..

Group 1
Details
Group 1a
Details
Group 2
Detail

or
PO # PO Desc
10000 PO Desc 1
PO Line Po Line Desc
1 Po line desc 1
Asset Serial Asset Desc
123434 Test Desc
123321 Test Desc 2

I just can't figure out how to filter the arraylist of beans using simple struts tags and easily format the html.. I'm I crazy?
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From what I can see, it shouldn't be too difficult.

Would it be possible for you to provide either:
A) A link to a sample html of the table layout or
B) the tables with TRs and TDs written in your post

Also some more information about what your beans hold would help.

That would be much easier for me to write up a solution.
 
Rick Nendza
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks mark

To keep it simple.. lets say at the domain level I have an AssetBean with fields orgSid, orgName, poNum, poHeaderDesc, poHeaderContact,poLineNum, poLineDesc, assetID, serialNum,assetDesc
(we will leave the asset (final nest out for simplication purposes)

After running the query I am populating an ArrayList with AssetBeans.
I want this





 
Marc Peabody
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it correct to say that the database results are not normalized (by that I mean that you could end up with two or more AssetBeans with the same orgSid)???

If so.... a little OOAD refactoring should help out a ton.
It would be much easier in Struts tags to iterate if you had collections within collections.
For example, we'll start by changing the name AssetBean to OrgBean and
each OrgBean would contain a unique:
* orgSid String,
* orgName String,
* and ArrayList of POBeans (or whatever you want to call them).

That way you can iterate through the OrgBeans and then within each iteration grab its ArrayList of POBeans and iterate through it. Further, each POBean would probably have a collection of AssetBeans, where each AssetBean is composed of assetID, serialNum, and assetDesc.

I hope this is of some assistance to you.
 
Rick Nendza
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is true.. that is one method that I considered.. However I'm currently using a sql mapping tool called iBatis to map the sql call to a an object of my choice. (in this case bean). why I know I can probably tweak it so map to many beans i was a little worried about possible overhead and memory usuage involved.. ie.. just returning the entire query back into a "flat" bean seemed as if it would be the fastest!!! But thanks for your help!
 
reply
    Bookmark Topic Watch Topic
  • New Topic