This problem occurs during struts2 development. The web. XML is as follows:
<? XML version = "1.0" encoding = "UTF-8"?>
<Web-app id = "person" version = "2.4"
Xmlns = "http://java.sun.com/xml/ns/j2ee"
Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
Xsi: schemalocation = "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<Display-Name> person </display-Name>
<! -- Include this if you are using hibernate -->
<Filter>
<Filter-Name> spring openentitymanagerinviewfilter </filter-Name>
<Filter-class>
Org. springframework. Orm. JPA. Support. openentitymanagerinviewfilter
</Filter-class>
</Filter>
<Filter-mapping>
<Filter-Name> spring openentitymanagerinviewfilter </filter-Name>
<URL-pattern>/* </url-pattern>
</Filter-mapping>
<Filter>
<Filter-Name> struts2 </filter-Name>
<Filter-class>
Org. Apache. struts2.dispatcher. filterdispatcher
</Filter-class>
</Filter>
<Filter-mapping>
<Filter-Name> struts2 </filter-Name>
<URL-pattern>/* </url-pattern>
</Filter-mapping>
<! -- Filters -->
<Filter>
<Filter-Name> action2-cleanup </filter-Name>
<Filter-class>
Org. Apache. struts2.dispatcher. actioncontextcleanup
</Filter-class>
</Filter>
<Filter>
<Filter-Name> sitemesh </filter-Name>
<Filter-class>
Com. opensymphony. Module. sitemesh. Filter. pagefilter
</Filter-class>
</Filter>
<Filter>
<Filter-Name> Action2 </filter-Name>
<Filter-class>
Org. Apache. struts2.dispatcher. filterdispatcher
</Filter-class>
</Filter>
<Filter-mapping>
<Filter-Name> action2-cleanup </filter-Name>
<URL-pattern>/* </url-pattern>
</Filter-mapping>
<Filter-mapping>
<Filter-Name> sitemesh </filter-Name>
<URL-pattern>/* </url-pattern>
</Filter-mapping>
<Filter-mapping>
<Filter-Name> Action2 </filter-Name>
<URL-pattern>/* </url-pattern>
</Filter-mapping>
<Taglib>
<Taglib-Uri> sitemesh-decorator </taglib-Uri>
<Taglib-location>
WEB-INF/sitemesh-decorator.tld
</Taglib-location>
</Taglib>
<Taglib>
<Taglib-Uri> sitemesh-page </taglib-Uri>
WEB-INF/sitemesh-page.tld </taglib-location>
</Taglib>
<Welcome-file-List>
<Welcome-File> index. jsp </welcome-File>
</Welcome-file-List>
<Listener>
<Listener-class>
Org. springframework. Web. Context. contextloaderlistener
</Listener-class>
</Listener>
</Web-app>
After the taglib label is added, eclipse will report the cvc-complex-type.2.4.a: Invalid Content was found starting with element 'taglib'... error.
The solution is to add a JSP-config tag outside taglib:
<JSP-config>
<Taglib>
<Taglib-Uri> sitemesh-decorator </taglib-Uri>
<Taglib-location>
WEB-INF/sitemesh-decorator.tld
</Taglib-location>
</Taglib>
<Taglib>
<Taglib-Uri> sitemesh-page </taglib-Uri>
WEB-INF/sitemesh-page.tld </taglib-location>
</Taglib>
</JSP-config>
<JSP-config> detailed description of tag usage
<JSP-config> includes two sub-elements: <taglib> and <JSP-property-group>.
The <taglib> element already exists in JSP 1.2, and <JSP-property-group> is a new element in JSP 2.0.
The <JSP-property-group> elements mainly have eight child elements:
1. <description>: Set description;
2. <display-Name>: Set the name;
3. <URL-pattern>: Set the range affected by the value, for example,/CH2 or/*. jsp;
4. <El-ignored>: if it is true, El syntax is not supported;
5. <Scripting-invalid>: if it is true, the <% scripting %> syntax is not supported;
6. <page-encoding>: sets the JSP page encoding;
7. <include-prelude>: Set the JSP page header with the extension. jspf;
8. <include-coda>: set the end of the JSP page with the extension. jspf.