Don't Forget the DTD in the Servlet!
I was cleaning up the html and css used by a couple of servlets and a static html page and noticed the browser was displaying larger text for the dynamic html generated by the servlets than for the static html page. The servlets and the html use the same cascading style sheet which controls the look and position of a common banner displayed on all pages.
It took while, but I finally discovered I hadn’t included the document type definition (DTD) at the beginning of the servlets’ HTML. I didn’t realize this before, but the browser apparently checks for this directive and uses it to determine things like, uh, font sizes. After adding an out.println(“<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">”) to the servlets everything settled down.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home