web.xml文件头出错
2017-02-17 08:36
113 查看
原先将web.xml文件头设置为如下格式
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
但在编译时就报错:
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.
- No grammar constraints (DTD or XML Schema)
referenced in the document.
如下图:
据查是文件头有错误,换个就可以了,可这个文件头是我从tomcat文件夹下的web.xml中拷贝的,相对于换一个文件头,我更倾向于从自身上找原因。。
下面简要说明不换文件头也可以改正错误的方法。
首先说第二条错误- No grammar constraints (DTD or XML Schema) referenced in the document.
解决办法是。。。。ctrl+s,这确实是我的疏忽。。滑稽脸
针对第一条:- cvc-complex-type.2.3: Element 'web-app' cannot have character [children], because the type's content type is
element-only.
解决办法是:将<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" ...中的javaee改为j2ee
如下所示
问题就解决了。。
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
但在编译时就报错:
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.
- No grammar constraints (DTD or XML Schema)
referenced in the document.
如下图:
据查是文件头有错误,换个就可以了,可这个文件头是我从tomcat文件夹下的web.xml中拷贝的,相对于换一个文件头,我更倾向于从自身上找原因。。
下面简要说明不换文件头也可以改正错误的方法。
首先说第二条错误- No grammar constraints (DTD or XML Schema) referenced in the document.
解决办法是。。。。ctrl+s,这确实是我的疏忽。。滑稽脸
针对第一条:- cvc-complex-type.2.3: Element 'web-app' cannot have character [children], because the type's content type is
element-only.
解决办法是:将<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" ...中的javaee改为j2ee
如下所示
问题就解决了。。
相关文章推荐
- web.xml文件出错导致了There is no Action mapped for namespace / and action name
- 解决插件maven-war-plugin在没有web.xml文件时打包出错
- 部署时的参数文件(web.xml)
- web.xml 文件中定义和映射Servlet(2/3)(转)
- web.xml文件中配置mime下载文件类型
- webconfig.xml文件golbalization节的作用
- 在页面中直接设计TreeView的节点而不使用Web.Sitemap文件在运行时出错信息
- web.xml 文件中定义和映射Servlet(1/3)
- Struts配置文件详解,web.xml以及struts-cofig.xml,以及struts-cofig.xml中各个标签的作用。
- 在页面中直接设计TreeView的节点而不使用Web.Sitemap文件在运行时出错
- 在页面中直接设计TreeView的节点而不使用Web.Sitemap文件在运行时出错
- 遍历读取XML文件及web.config的动态更新
- Struts+Spring+Hibernate实例——web.xml文件
- 应用程序部署文件Web.xml
- WEB行为文件*.HTC 文件及XML行为应用
- 在页面中直接设计TreeView的节点而不使用Web.Sitemap文件在运行时出错
- web.xml 文件中定义和映射Servlet(1/3)(转)
- 开启servlet调试器,在不修改web.xml文件的情况下也能运行servlet
- struts配置文件讲解:web.xml和struts-config.xml
- 在页面中直接设计TreeView的节点而不使用Web.Sitemap文件在运行时出错信息