element filtername is not allowed here

背景:最近在使用IntellijIdea2016搭建项目的时候,在web.xml中出现了element filtername is not allowed here的错误。

原因:总体来讲,后来查出来的原因是web.xml头部的配置有错误的,当然网上也有说各种原因的。

解决办法:更换web.xml头部(代码中前4行)

我目前的配置如下,如果遇到该问题可以参考如下:

<?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"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         id="WebApp_ID" version="3.0">
    <!-- 配置Spring配置文件路径 -->
    <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>
        classpath:applicationContext.xml
      </param-value>
    </context-param>
    <!-- 配置Spring上下文监听器 -->
    <listener>
      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!-- 配置Spring字符编码过滤器 -->
    <filter>
      <filter-name>encodingFilter</filter-name>
      <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
      <init-param>
        <param-name>encoding</param-name>
        <param-value>UTF-8</param-value>
      </init-param>
      <init-param>
        <param-name>forceEncoding</param-name>
        <param-value>true</param-value>
      </init-param>
    </filter>
    <filter-mapping>
      <filter-name>encodingFilter</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- 配置log4j配置文件路径、检测日志配置文件变化 -->
    <context-param>
      <param-name>log4jConfigLocation</param-name>
      <param-value>classpath:log4j.properties</param-value>
      <param-name>log4jRefreshInterval</param-name>
      <param-value>30000</param-value>
    </context-param>
    <!-- 配置Log4j监听器 -->
    <listener>
      <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>

    <!-- 首页 -->
    <welcome-file-list>
      <welcome-file>/index.jsp</welcome-file>
    </welcome-file-list>

    <!-- 错误页 -->
    <error-page>
      <error-code>404</error-code>
      <location>/error/404.jsp</location>
    </error-page>
    <error-page>
      <error-code>500</error-code>
      <location>/error/500.jsp</location>
    </error-page>
  </web-app>

资料参考:http://stackoverflow.com/questions/17563756/element-listener-class-not-allowed-in-my-web-xml

http://blog.csdn.net/cor_twi/article/details/51063541

您好!要在 Element UI 的表格中进行筛选,您可以使用表格组件提供的筛选功能。以下是一些步骤和示例代码,供您参考: 1. 首先,在需要使用表格的组件中导入 Element UI 的 Table 和 TableColumn 组件。 ```javascript import { Table, TableColumn } from 'element-ui'; ``` 2. 在模板中使用 Table 组件,并在其中定义表格的列和数据源。 ```html <template> <div> <table> <el-table :data="tableData" style="width: 100%;"> <el-table-column prop="name" label="姓名"></el-table-column> <el-table-column prop="age" label="年龄"></el-table-column> <el-table-column prop="gender" label="性别"></el-table-column> </el-table> </table> </div> </template> ``` 3. 在 Vue 实例中定义表格的数据源,并在需要的时候使用 filter 方法进行筛选。 ```javascript export default { data() { return { tableData: [ { name: '张三', age: 20, gender: '男' }, { name: '李四', age: 25, gender: '女' }, { name: '王五', age: 22, gender: '男' } ] }; } }; ``` 4. 如果您想在表格中的某一列中加入筛选功能,可以使用 filter-method 属性和 scoped-slot 来实现。 ```html <template> <div> <table> <el-table :data="tableData" style="width: 100%;"> <el-table-column prop="name" label="姓名" :filter-method="filterName"></el-table-column> <el-table-column prop="age" label="年龄"></el-table-column> <el-table-column prop="gender" label="性别"></el-table-column> </el-table> </table> </div> </template> <script> export default { data() { return { tableData: [ { name: '张三', age: 20, gender: '男' }, { name: '李四', age: 25, gender: '女' }, { name: '王五', age: 22, gender: '男' } ] }; }, methods: { filterName(value, row) { return row.name.toLowerCase().includes(value.toLowerCase()); } } }; </script> ``` 在上面的例子中,我们在姓名列中定义了一个 filter-method 方法,用于筛选姓名。该方法会接收两个参数:筛选输入的值 value 和当前行的数据 row。您可以根据自己的需求进行筛选逻辑的编写。 希望以上信息对您有所帮助!如果还有其他问题,请随时提问。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值