简体   繁体   English

使用IDE在我的spring mvc应用程序中创建过滤器

[英]creating a filter in my spring mvc application using IDE

I'm trying to create a filter, for some reason I am not seeing autocompletion when I create a class that implements a Filter. 我试图创建一个过滤器,由于某种原因,当我创建一个实现过滤器的类时,我没有看到自动补全。

When I type: 当我输入:

import javax.servlet

IDEA doesn't seem to pickup the namespace. IDEA似乎没有采用命名空间。

Is this a separate .jar that I have to setup in maven? 这是我必须在Maven中设置的单独的.jar吗?

Update 更新

My filter mappings look like: 我的过滤器映射如下所示:

<filter>

        <filter-name>performancefilter</filter-name>
        <filter-class>com.blah.core.filters.PerformanceFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>performancefilter</filter-name>
        <url-pattern>/</url-pattern>
    </filter-mapping>

I'm trying to create a filter, for some reason I am not seeing autocompletion when I create a class that implements a Filter. 我试图创建一个过滤器,由于某种原因,当我创建一个实现过滤器的类时,我没有看到自动补全。

Then you probably don't have the servlet-api defined as dependency in your pom.xml . 那么您可能没有在pom.xml中将servlet-api定义为依赖项。 Assuming you're using Servlet 2.5, your pom.xml should declare: 假设您使用的是Servlet 2.5,则pom.xml应该声明:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.5</version>
    <scope>provided</scope>
</dependency>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Spring MVC应用程序中使用jclouds创建BlobContext时出错 - Error creating BlobContext using jclouds in a Spring MVC application 在Spring MVC应用程序中使用CXF创建SOAP客户端时出错 - Error while creating SOAP client using CXF in Spring MVC application 如何在没有任何 IDE 的情况下运行基本的 Spring MVC 应用程序? - How to run a basic Spring MVC Application without any IDE? 使用服务创建基于Java Spring MVC 3的应用程序, - Creating Java Spring MVC 3 based application with services, 如何使用 Spring MVC 创建我自己的过滤器? - How to create my own filter with Spring MVC? 创建我的第一个Spring MVC项目时出错 - Errors creating my first spring mvc project 使用Spring Boot构建Spring MVC应用程序 - Building Spring MVC application using Spring Boot 在现有的带有JSP的Spring中使用Spring MVC - Using Spring MVC in an existing Spring with JSP application 使用CMS(Drupal,Joomla,Wordpress等)创建论坛,并在Spring MVC Web应用程序中使用该论坛 - Creating a forum with a CMS (Drupal, Joomla, Wordpress etc.), and using that forum in a spring MVC web application 将Facebook身份验证添加到我的Spring MVC应用程序中 - Adding Facebook authentication to my Spring MVC application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM