This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I've noticed this issue appear in multiple posts in this sub-forum. I apologize if this is the wrong spot to bring this up, but I think it might be helpful.
I've been reading up on servlet programming in Core Servlets and JavaServer Pages, Vol. 1 by Marty Hall. One of the conventions which this book uses is that the first line of the Document Descriptor is
The author explains that the encoding allows it to work with both serlets 2.3 (JSP 1.2) and servlets 2.4 (JSP 2.0). However, this appears in a number of threads where someone has said that it was causing their servlet to not be recognized. Apparently, in some cases, substituting UTF-8 for ISO-8859-1 has resolved the issue. Since this is a popular book, perhaps this would be a good addition to the FAQ under things to check if your servlet is not working?
Has anyone had this issue with Headfirst Servlets?
This is interesting, but it also sounds a bit odd. The encoding of the web.xml file is not supposed to make any difference to the working of the web app.
XML requires that UTF-8 be supported, but not ISO-8859-1, although all major parsers do (certainly all the ones ever shipped with a JRE do). But if a parser encounters a file in an unknown encoding, then it should throw an exception to that effect.
Maybe in the cases were this was reported as the solution, the file was not actually in the encoding that the "encoding" attribute said it was?