我在 Eclipse 中使用 Google App Engine 和 Google 插件,这是我的 web.xml 的 header :
<?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"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
根据一些 GAE 文档,我添加了以下内容:
<security-constraint>
<web-resource-collection>
<url-pattern>/tasks/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
但是 Eclipse 在“url-pattern”处报告错误:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'url-pattern'.
One of '{"http://java.sun.com/xml/ns/javaee":web-resource-name}' is expected.
我可以启动应用程序,并且它似乎可以很好地处理 web.xml 文件,但我不喜欢 Eclipse 报告错误。有什么问题吗?
最佳答案
嗯,这个错误看起来非常简单 - 它期望在 url-pattern 之前有一个 web-resource-name 标签:)
干杯
关于java - Eclipse 在我的 web.xml 中报告问题,但处理得很好,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6796692/