When configuring my first struts 2, I created a new web project in MyEclipse 8.6, and then the web.xml under Webroot/WEB-INF is automatically generated. The XML header file information is:
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
When I filled in the code for configuring Struts2, I reported an error:
1. Struts 2 Code:
<display-name>My First struts2 Programmer</display-name> <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>
2. Error:
Multiple annotations found at this line: - cvc-complex-type.2.3: Element 'web-app' cannot have character [children], because the type's content type is element-only.
Later, it was found that there was no problem with the Struts2 configuration code, but with the third line in the XML header file:
xmlns=” http://java.sun.com/xml/ns/javaee ”
Maybe it’s the habit of using J2EE all the time? It’ll be fine after it’s changed to J2EE anyway
Similar Posts:
- Spring MVC: How to Solve Chinese garbled code Issue
- Struts 2.0 Error: The Struts dispatcher cannot be found (Error 500 Internal Server Error)
- How to Solve Error: Preflight response is not successful
- [Solved] Dubbo uses filter error: No such extension consumerStaticFilter for filter/com.alibaba.dubbo.rpc.Filter
- Tomcat set x-frame-option
- How to Solve Error: The content of element type “web-app” must match “(icon?display
- Failed to resolve filter error [How to Solve]
- [Solved] IDEA javaweb web.xml File Error: Invalid content was found starting with element
- [Solved] Spring Error: Artifact spring:war exploded: Error during artifact deployment. See server log for details
- Failed to decode downloaded font [How to Solve]