Kor*_*gay 12 jsf url-pattern java-ee servlet-mapping
这是我的web.xml:
<servlet-mapping>
<servlet-name>Faces Servlet</servlet>
<url-pattern>/*</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud)
当我导航到:
http://localhost:8080/LearningRoot/index.xhtml
Run Code Online (Sandbox Code Playgroud)
我可以看到页面很好,但是当我导航到:
http://localhost:8080/LearningRoot/
Run Code Online (Sandbox Code Playgroud)
我收到错误:
发生错误:
FacesServlet不能具有/*的url模式.请定义一个不同的url模式.
但为什么?
这是我的欢迎档案:
<welcome-file-list>
<welcome-file>/index.xhtml</welcome-file>
</welcome-file-list>
Run Code Online (Sandbox Code Playgroud)
kol*_*sus 19
因为这意味着所有曾经命中过上下文的东西都将由FacesServlet处理,这是FacesServlet已经知道它无法实现的要求(显然没有意义).
要实现您想要的.xhtml
映射,请在FaceServlet上使用映射
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
14339 次 |
最近记录: |