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.

有帮助吗?

解决方案

This mapping doesn't make any sense. To which view should PrettyFaces forward if the client requests /viewer?

However, you can do something similar with Rewrite, which is the successor of 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:

  • /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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top