title: Why is creating Servlets in Eclipse breaking my web.xml?
body: <p>Being somewhat lazy, I was rather happy to find that I could create a new servlet source code by going New -> Servlet, instead of going New -> Class and then editing the class into a servlet.</p>
  
  <p>However, I have discovered that every time I create a new servlet in Eclipse, Eclipse modifies my web.xml.</p>
  
  <p>Specifically, it modifies the top element to:</p>
  
  <pre><code>&lt;web-app 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns="http://java.sun.com/xml/ns/j2ee" 
      xmlns:javaee="http://java.sun.com/xml/ns/javaee" 
      xmlns:jsp="http://java.sun.com/xml/ns/javaee/jsp" 
      xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
          http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" 
      id="WebApp_ID" version="2.4"&gt;
  </code></pre>
  
  <p>(Linebreaks mine.)</p>
  
  <p>This doesn't seem necessarily bad, but then it modifies various sub-elements by putting "javaee:" in front of their name, to indicate that these elements belong in that namespace.</p>
  
  <p>For example, it changes</p>
  
  <pre><code>&lt;display-name&gt;ShowLifecycles&lt;/display-name&gt;
  </code></pre>
  
  <p>to</p>
  
  <pre><code>&lt;javaee:display-name&gt;ShowLifecycles&lt;/javaee:display-name&gt;
  </code></pre>
  
  <p>After which eclipse then complains about all the elements it modified, giving me notations like:</p>
  
  <pre><code>cvc-complex-type.2.4.a: Invalid content was found starting with element 'javaee:display-name'. One of '{"http://
   java.sun.com/xml/ns/j2ee":description, "http://java.sun.com/xml/ns/j2ee":display-name, "http://java.sun.com/xml/ns/
   j2ee":icon, "http://java.sun.com/xml/ns/j2ee":distributable, "http://java.sun.com/xml/ns/j2ee":context-param, "http://
   java.sun.com/xml/ns/j2ee":filter, "http://java.sun.com/xml/ns/j2ee":filter-mapping, "http://java.sun.com/xml/ns/
   j2ee":listener, "http://java.sun.com/xml/ns/j2ee":servlet, "http://java.sun.com/xml/ns/j2ee":servlet-mapping, "http://
   java.sun.com/xml/ns/j2ee":session-config, "http://java.sun.com/xml/ns/j2ee":mime-mapping, "http://java.sun.com/xml/ns/
   j2ee":welcome-file-list, "http://java.sun.com/xml/ns/j2ee":error-page, "http://java.sun.com/xml/ns/j2ee":jsp-config, "http://
   java.sun.com/xml/ns/j2ee":security-constraint, "http://java.sun.com/xml/ns/j2ee":login-config, "http://java.sun.com/xml/ns/
   j2ee":security-role, "http://java.sun.com/xml/ns/j2ee":env-entry, "http://java.sun.com/xml/ns/j2ee":ejb-ref, "http://
   java.sun.com/xml/ns/j2ee":ejb-local-ref, "http://java.sun.com/xml/ns/j2ee":service-ref, "http://java.sun.com/xml/ns/
   j2ee":resource-ref, "http://java.sun.com/xml/ns/j2ee":resource-env-ref, "http://java.sun.com/xml/ns/j2ee":message-
   destination-ref, "http://java.sun.com/xml/ns/j2ee":message-destination, "http://java.sun.com/xml/ns/j2ee":locale-
   encoding-mapping-list}' is expected.
  </code></pre>
  
  <p>To make matters worse, when I use find and replace to delete all to "javaee:" which litters the file, Eclipse still complains about these even though they are no longer there.  I must copy and paste the entire remaining file on top of itself to make these complaints go away.</p>
  
  <p>I am sure Eclipse is trying to be useful, anticipating some desire or need for this namespace.  How can I do either one of two things:</p>
  
  <ol>
  <li><p>Make it stop doing this?</p></li>
  <li><p>Take advantage of whatever it is trying to do, and make it work for me instead of against me?</p></li>
  </ol>