Elemen taglib in web.xml


When I validate web.xml, I got this error message :
XML validation started.
Checking file:/C:/temp/konoho/web/WEB-INF/web.xml…
cvc-complex-type.2.4.a: Invalid content was found starting with element ‘taglib’. One of ‘{“http://java.sun.com/xml/ns/javaee”:description, “http://java.sun.com/xml/ns/javaee”:display-name, “…..’ is expected. [685]
XML validation finished.

My previous web.xml

<web-app>

<taglib>
<taglib-uri>http://jakarta.apache.org/struts/tags-bean</taglib-uri&gt;
<taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://jakarta.apache.org/struts/tags-html</taglib-uri&gt;
<taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>
</taglib>

</web-app>

To fix this, add tag <jsp-config> , because <taglib>is not a direct sub-element of the tag <web-app>.

<web-app>

<jsp-config>
<taglib>
<taglib-uri>http://jakarta.apache.org/struts/tags-bean</taglib-uri&gt;
<taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://jakarta.apache.org/struts/tags-html</taglib-uri&gt;
<taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>
</taglib>
</jsp-config>

</web-app>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: