[英]Pretty faces: one mapping configuration for multi .xhtml page
I have one question. 我有一个问题。 How could pretty faces do this:
漂亮的面孔怎么做到这一点:
<code>
<url-mapping id="home">
<pattern value="/viewer" />
<view-id value="/pages/*" />
</url-mapping>
</code>
Well, I wonder if pretty faces could hide paths of all .xhtml in folder using just one configuration as shown as above, instead of to config for each and every file. 好吧,我想知道漂亮的面孔是否可以仅使用一种配置来隐藏文件夹中所有.xhtml的路径,如上所述,而不是针对每个文件进行配置。
This mapping doesn't make any sense. 这种映射没有任何意义。 To which view should PrettyFaces forward if the client requests
/viewer
? 如果客户端请求
/viewer
PrettyFaces应该转发到哪个视图?
However, you can do something similar with Rewrite , which is the successor of PrettyFaces. 但是,您可以使用Rewrite来做类似的事情,后者是PrettyFaces的后继者。 With Rewrite you can do something like:
使用重写,您可以执行以下操作:
.addRule( Join.path("/viewer/{page}").to("/pages/{page}.xhtml") )
This will basically map your URLs like this: 基本上可以这样映射您的URL:
/viewer/foo -> /pages/foo.xhtml
/viewer/bar -> /pages/bar.xhtml
/viewer/whatever -> /pages/whatever.xhtml
If you want to migrate your app to Rewrite, which is really simple, have a look at the PrettyFaces Migration Guide . 如果您想将应用程序迁移到Rewrite(这很简单),请参阅《 PrettyFaces迁移指南》 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.