Java 欢迎页面的Servlet web.xml身份验证

Java 欢迎页面的Servlet web.xml身份验证,java,servlets,jetty,web.xml,Java,Servlets,Jetty,Web.xml,我有一个web.xml,它看起来像: <web-app> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <security-constraint> <web-resource-collection> <web-resource-name>Default</web

我有一个web.xml,它看起来像:

<web-app>

<welcome-file-list>
   <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<security-constraint>
  <web-resource-collection>
    <web-resource-name>Default</web-resource-name>
    <url-pattern>/</url-pattern>
  </web-resource-collection>
  <auth-constraint/>
</security-constraint>

<security-constraint>
  <web-resource-collection>
    <web-resource-name>Index page</web-resource-name>
    <url-pattern>/index.jsp</url-pattern>
    <url-pattern>/</url-pattern>
    <http-method>GET</http-method>
    <http-method>HEAD</http-method>
  </web-resource-collection>
</security-constraint>
...

index.jsp
违约
/

但是,如果转到允许他们进入,他们将被拒绝访问。两个URL应该显示相同的页面,并且都应该被允许。这里我做错了什么?

我认为应该指定
/*
来捕获默认值,并执行特定的模式,如
/somethingElse.jsp
来捕获任何其他非index.jsp的页面。希望您的顶级“目录”不是很杂乱。

我认为要做的事情是指定
/*
来捕获默认值,并执行特定的模式,如
/somethingElse.jsp
来捕获任何其他非index.jsp的页面。希望你的顶级“目录”不是很杂乱。

我要把那份声明,用大号字母打印出来,框起来挂在我的桌子上:)我要把那份声明,用大号字母打印出来,框起来挂在我的桌子上:)