这是我的web.xml:
<servlet-mapping>
<servlet-name>Faces Servlet</servlet>
<url-pattern>/*</url-pattern>
</servlet-mapping>当我导航到:
http://localhost:8080/LearningRoot/index.xhtml我可以很好地看到页面,但是当我导航到:
http://localhost:8080/LearningRoot/我知道错误:
发生了一个错误: FacesServlet不能有/*的url模式.请定义一个不同的url-模式.
但是为什么呢?
这是我的欢迎文件:
<welcome-file-list>
<welcome-file>/index.xhtml</welcome-file>
</welcome-file-list>发布于 2013-03-04 21:27:22
因为这将意味着Everything (任何访问该上下文的)都将由FacesServlet来处理,FacesServlet已经知道它不可能满足这个要求(这显然是没有意义的)。
要实现您想要的映射,请在.xhtml上使用FaceServlet映射
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>https://stackoverflow.com/questions/15210420
复制相似问题