This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Possible addition to the Servlet FAQ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Possible addition to the Servlet FAQ" Watch "Possible addition to the Servlet FAQ" New topic
Author

Possible addition to the Servlet FAQ

Lou Umile
Greenhorn

Joined: Jan 28, 2010
Posts: 19
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?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41155
    
  45
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?


Ping & DNS - my free Android networking tools app
 
 
subject: Possible addition to the Servlet FAQ
 
Similar Threads
jstl problem in Spring MVC
setup tomcat6 folders in ubuntu
Character encoding
Insert a Symbol into a TextArea String
Stuck on HelloWorldServlet