JSF中的欢迎页面 [英] Welcome page in JSF

查看:109
本文介绍了JSF中的欢迎页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用JSF页面作为欢迎文件? FacesServlet映射到*.jsf,并且<welcome-file>设置为index.xhtml.但是,它没有显示JSF组件.我试图将<welcome-file>设置为index.jsf,但这会导致HTTP 404错误.

How can I use a JSF page as welcome file? The FacesServlet is mapped on *.jsf and the <welcome-file> is set to index.xhtml. However, it does not show the JSF components. I tried to set the <welcome-file> to index.jsf, but this results in a HTTP 404 error.

我正在使用Tomcat 6.0和JSF 2.1.

I'm using Tomcat 6.0 and JSF 2.1.

推荐答案

只需将index.xhtml<welcome-file>条目重命名为index.jsf,并在index.jsf文件>欺骗该文件实际存在的容器.

Just rename <welcome-file> entry of index.xhtml to index.jsf and create an empty index.jsf file next to index.xhtml to fool the container that the file actually exist.

或者,您也可以完全摆脱.jsf扩展名,并完全使用.xhtml.可以通过将FacesServlet<url-pattern>*.jsf更改为*.xhtml来完成.

Alternatively, you can also just get rid of the .jsf extension altogether and use .xhtml all the way. This can be done by changing <url-pattern> of FacesServlet from *.jsf to *.xhtml.

这篇关于JSF中的欢迎页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆