zoukankan      html  css  js  c++  java
  • 配置struts2 web.xml 报错

    我在配置自己第一个struts2的时候,是在myeclipse8.6中创建了一个新的Web Project,然后WebRoot/WEB-INF下的web.xml是自动生成的,xml头文件信息为:

    <?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"
    >

    当我把配置struts2的代码填进去之后,竟然报错:

    1.struts2代码:

    <display-name>我的第一个struts2程序</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.报错:

    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.

    后来发现,并不是struts2配置代码有问题,而是xml头文件中,第三行有问题:

    xmlns="http://java.sun.com/xml/ns/javaee"

    可能是一直用j2ee习惯?反正改成j2ee之后就好了。


  • 相关阅读:
    Js特效总结
    asp.net中的绝对路径和相对路径
    GrideView合并列合并序号,隐藏某列按钮
    WebConfig 配置文件详解
    ASP.NET打印EXCEl报表技术总结
    ADO.NET DataSet、DataTable、DataRow、DataView的学习
    asp.netGridView使用技巧
    .net Remoting
    C# webservice开发
    js实现网页打印分页打印
  • 原文地址:https://www.cnblogs.com/lihuiyy/p/2395357.html
Copyright © 2011-2022 走看看