• Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding HTML DOCTYPE and meta attributes in header of page generated by jsp  RSS feed

 
Annie Jones
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I would like to know what the best approach to putting the DOCTYPE attribute into all my HTML generated by my jsp pages is, I want this in every generated web page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Also, I would like to have this declaration inside the head tag of all my pages:

<meta http-equiv="content-type" content="text/html; charset=UTF-8">


Could someone tell me what the best approach to doing this is, so that I only need to change it in one place and all my other JSP pages will get the same declarations?

Thanks!
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're not using a templating system it might be easiest to just put them into a separate file which can then be included with the include taglib directive or JSP's include tag. Which to use is discussed in a JavaRanch FAQ entry here as well as many web resources.

If you're using a templating system of some sort then it depends on which one you're using.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use a prelude.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ha, I didn't even know about preludes/codas. I wonder how many other old EE things I don't know?!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!