There are two main approaches to generating dynamic pages:
Generation of HTML from servlets or handlers
Template HTML files which have previously been authored, are modified with dynamic elements.Which approach is best depends on the circumstances. Generation allows for greater configuration control and reuse of common elements, but requires programming skills and can be tedious for large once-off static pages. Templates can be a configuration and/or reuse problem, but allow page development to be done by HTML authors using standard tools.
Most complex sites (including this one) will end up using a combination of the techniques, skewed towards the experience and background of the developers and maintainers.