• 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

Design patterns for templates (or something like that ...)

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,

I'm developing a webapp which has a web structure similar to a portal (well, it actually is a portal!).
Like in every other portal on the web, there will be a great number of pages which all have the same structure, i.e. an header, a navigation bar, left and right menu's, a footer and so on. The content of every singular module is generated dinamically and imported in every JSP, so no problem at this.
What is making me worrying is the general structure of the page, which must be identical for every page on the portal. I'd like to use or write a template engine (or something like that) to handle the structure of the page (dimensions of header, width of menu's, position of some elements and so on).
This is not an hard job actually, I can think of more than one solutions to this, but I'd like to do it in the "proper" way. I.e. is there a well known, maybe "standard" engine out there to handle these kind of things, or maybe a design pattern you can apply to design it in the right way ? I would not like to discover that what I implement is not good for some reason (maybe not scalable, not flexible or whatever).
Just to make things more clear, I'll provide a stupid example. I got a page named header.jsp in which is written (wohoo, big surprise!) the content of the header for every page. The header is included in every page with :



The header has a width which is obviously equal for each page, but every page has to adjust the width of the table of the main content to fit the header. If I decide to change the header width, I must change each jsp to fit the new width. I could extrapolate a set of variables that organize the structure of the jsp and then set those variables values for each jsp, but then I have to handle these variables in some way, and it seems to me I would go with a private implementation that could result sooner or later in a bad design which would require a total reorganization of the whole portal.
I'm basically looking for design patterns for portals templates manipulation.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Observation 1: tag files would be a cleaner implementation than includes for the header.

Observation 2: the rest sounds like more of a CSS issue than JSP one.
[ July 12, 2008: Message edited by: Bear Bibeault ]
 
Matteo Di Furia
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bibeault,

I know what I'm near to write will sound like a blasfemy, but ... I use CSS only for graphic management of the components, dimensions and position of modules are organized via HTML tables ...
And if I could ask, what do you mean with tag files ? Could you provide me an example ? Maybe I know those with another name, but whatever.
Thank you for your help. By the way, I'm browsing the web for this problem and I found something about the Composite View pattern, do you think this could be a reasonable solution ? (I'm still reading on it, don't know if it's related to this problem or not)
reply
    Bookmark Topic Watch Topic
  • New Topic