Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

design question  RSS feed

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is (probably) a "there is no right answer" question about design:
when designing a site that will have a standard header, is it considered better form to have a Header object that will get instantiated on every page just so you can call a method that does some processing/database hits and then writes the header html, or is it better to have a class with a bunch of static methods that handle this kind of thing (dynamic headers, footers, breadcrumbs, etc.). btw, i'm using jsp.
or maybe there's another way altogether...
thanks!
ed
 
Author
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a solution
1) Create a JavaBean that handles the database.
2) Create a file header.jsp that uses the bean and displays the info.
3) In all other files include the header.jsp at the required place.
use the include directive <%@ include file='header.jsp' %> or
use the include action <jsp:include page='header.jsp' />
 
ed copony
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that sounds good, but what if the header builds a breadcrumb that is based on a node id on the page that does the including? is there a way to get the bean some information it needs to build the correct header?
 
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am moving this to the JSP forum...
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!