【发布时间】:2013-09-01 17:34:46
【问题描述】:
我有Login.xhtml 和Home.xhtml。我在web.xml中配置了url模式如下
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>Login.xhtml</welcome-file>
</welcome-file-list>
当我运行整个项目时,登录页面URL是这样的http://localhost:8080/fran/Login.xhtml,这里fran是我的项目名称..
但是,我希望它是 http://localhost:8080/fran/Login/ 而不是 http://localhost:8080/fran/Login.xhtml。
我怎样才能做到这一点?是否可以为每个页面自定义<url-pattern> 以摆脱.xhtml 扩展?
【问题讨论】:
-
看看ocpsoft.org/prettyfaces,看看2。在主页面创建 pretty-config.xml 示例
-
@Daniel ..ya ocpsoft.org/prettyfaces 是一个不错的选择。在
pretty faces中是否需要在web.xml中配置Pretty filter -
OmniFaces FacesViews 提供了一种摆脱
.xhtml扩展的零配置方式。它已在 showcase.omnifaces.org 和 zeef.com 中使用。 -
@BalusC ..感谢您的回答..这很容易配置...并且绘制的文档非常棒..任何人都可以理解...我很高兴使用这个插件...感谢您的建议..
标签: jsf jsf-2 friendly-url