Jsf 为什么FacesServlet的url模式不能为/*。?
这是我的web.xml:Jsf 为什么FacesServlet的url模式不能为/*。?,jsf,jakarta-ee,url-pattern,servlet-mapping,Jsf,Jakarta Ee,Url Pattern,Servlet Mapping,这是我的web.xml: Facesservlet /* 当我导航到: http://localhost:8080/LearningRoot/index.xhtml http://localhost:8080/LearningRoot/ 我可以很好地看到页面,但是当我导航到: http://localhost:8080/LearningRoot/index.xhtml http://localhost:8080/LearningRoot/ 我得到一个错误: 发生错误: FacesSe
Facesservlet
/*
当我导航到:
http://localhost:8080/LearningRoot/index.xhtml
http://localhost:8080/LearningRoot/
我可以很好地看到页面,但是当我导航到:
http://localhost:8080/LearningRoot/index.xhtml
http://localhost:8080/LearningRoot/
我得到一个错误:
发生错误:
FacesServlet的url模式不能为/*。请定义不同的url模式。
但是为什么呢
这是我的欢迎文件:
/index.xhtml
因为这意味着所有命中该上下文根的内容都将由FacesServlet处理,FacesServlet已经知道它不可能满足这一要求(这显然没有意义)
要实现您想要的映射,请在FaceServlet上使用.xhtml
映射
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
Facesservlet
*.xhtml
@KorayTugay/
将根据标准webapp处理将其默认为索引
文件<代码>/*是一个不明确的名称reference@KeremBaydoğan您在真正的Java web应用程序中尝试过吗?没有:)那只是猜测:)