[英]web.xml intellij is not auto completing when adding servlet or filter
When i create a servlet or a filter in eclipse the xml code is automatically insert into the web.xml. 当我在eclipse中创建servlet或过滤器时,xml代码会自动插入到web.xml中。 But when i do the same thing in Intellij i need to manually edit the xml file.
但是当我在Intellij中做同样的事情时,我需要手动编辑xml文件。
When i type the code below in Intellij i get an error "filter should have mapping" But why is this not automatically created when i use the code below. 当我在Intellij中键入下面的代码时,我得到一个错误“过滤器应该有映射”但是为什么当我使用下面的代码时这不会自动创建。
<filter>
<filter-name>TestFilter</filter-name>
<filter-class>be.demoapp.filters.TestFilter</filter-class>
</filter>
There has to be a very simple answer for this but i can't figure out why Intellij does not auto complete the web.xml and eclipse does. 必须有一个非常简单的答案,但我无法弄清楚为什么Intellij不会自动完成web.xml和eclipse。 Or do i need to turn on some plugin.
或者我需要打开一些插件。 I can't find a good answer on this ?
我找不到一个好的答案吗?
Inside your class, use the annotation @WebFilter(name = "TestFilter", urlPatterns = "/TestFilter")
在你的课程中,使用注释
@WebFilter(name = "TestFilter", urlPatterns = "/TestFilter")
It won't show in web.xml
but it will do the trick. 它不会在
web.xml
显示,但它会起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.