I am using Eclipse Helios Release. Eclipse xml validator doesn't like the display-name
element under <servlet>
in my web.xml. Here's the relevant part:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID"
version="2.5">
<display-name>PropTax</display-name>
<servlet>
<servlet-name>PropTax</servlet-name>
<display-name>PropTax</display-name>
<servlet-class>org.slco.treasurer.propertytax.servlet.PropTax</servlet-class>
</servlet>
(...)
If I remove display-name element then there is no error anymore. If I understand correctly 2.5 is the right schema to support display-name, and even context help under the editor will list display-name as part of choice.
Could anyone help me here?
Error message from Eclipse validator:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'display-name'. One of '{"http://java.sun.com/xml/ns/javaee":servlet-class, "http://java.sun.com/xml/ns/javaee":jsp-file}' is expected. web.xml /PropTax/WebContent/WEB-INF line 6 XML Problem
You need to use the '101010' button to quote your XML for it to be readable.
However, according to the XSD you referenced, a servlet definition (servlet
tag) needs to have the description stuff (including display-name
) before the servlet-name
. Given the error you've posted, I suspect you've got servlet-name
followed by display-name
. However, it's hard to tell without seeing the XML well formatted.