I have this web.xml
<?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>jsp-tags</display-name>
<taglib>
<taglib-uri>mytags</taglib-uri>
<taglib-location>/WEB-INF/mytaglib.tld</taglib-location>
</taglib>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
The is highlighted and the error the IDE gives is: "Invalid content was found starting with element ...
What more do I need to do?
In the XSD referenced in your XML, it states that for complex type web-appType you can only have a choice of zero to many of the following elements: The taglib element is not referenced in the XSD at all. From reading this link it would seem that you do not need to declare taglibs in the web-app document.
The taglib element is not referenced in the XSD at all. From reading this link it would seem that you do not need to declare taglibs in the web-app document. Simply having the version="2.5" attribute means you can reference tags in your JSPs. Show activity on this post. If the taglib is inside of a maven dependency, just set the scope to compile.
In this tutorial, we'll discuss the common Eclipse error, “ web.xml is missing and <failOnMissingWebXml> is set to true “, that we get while creating a web application. 2. Eclipse Error In Java web applications, web.xml is the standard name of the deployment descriptor.
Voila! the web.xml file is generated under the WEB-INF/ directory. 4. Without web.xml In most cases, we may not require the web.xml file at all.
Use this notation:
<jsp-config>
<taglib>
<taglib-uri>mytags</taglib-uri>
<taglib-location>/WEB-INF/jsp/mytaglib.tld</taglib-location>
</taglib>
</jsp-config>
But I recommended to read this link. This tutorial will give you idea how to avoid declaring taglibs in web.xml in case of JSP 2.0
In the XSD referenced in your XML, it states that for complex type web-appType you can only have a choice of zero to many of the following elements:
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:group ref="javaee:descriptionGroup"/>
<xsd:element name="distributable"
type="javaee:emptyType"/>
<xsd:element name="context-param"
type="javaee:param-valueType">
</xsd:element>
<xsd:element name="filter"
type="javaee:filterType"/>
<xsd:element name="filter-mapping"
type="javaee:filter-mappingType"/>
<xsd:element name="listener"
type="javaee:listenerType"/>
<xsd:element name="servlet"
type="javaee:servletType"/>
<xsd:element name="servlet-mapping"
type="javaee:servlet-mappingType"/>
<xsd:element name="session-config"
type="javaee:session-configType"/>
<xsd:element name="mime-mapping"
type="javaee:mime-mappingType"/>
<xsd:element name="welcome-file-list"
type="javaee:welcome-file-listType"/>
<xsd:element name="error-page"
type="javaee:error-pageType"/>
<xsd:element name="jsp-config"
type="javaee:jsp-configType"/>
<xsd:element name="security-constraint"
type="javaee:security-constraintType"/>
<xsd:element name="login-config"
type="javaee:login-configType"/>
<xsd:element name="security-role"
type="javaee:security-roleType"/>
<xsd:group ref="javaee:jndiEnvironmentRefsGroup"/>
<xsd:element name="message-destination"
type="javaee:message-destinationType"/>
<xsd:element name="locale-encoding-mapping-list"
type="javaee:locale-encoding-mapping-listType"/>
</xsd:choice>
The taglib element is not referenced in the XSD at all.
From reading this link it would seem that you do not need to declare taglibs in the web-app document. Simply having the version="2.5" attribute means you can reference tags in your JSPs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With