开发者

Pretty Faces: Generic URL mapping

Using Pretty Faces 3, I have some mappings like these:

<url-mapping id="search"> 
    <pattern value="/search" /> 
    <view-id value="/views/sea开发者_开发百科rch.xhtml" />
</url-mapping> 

<url-mapping id="edit"> 
    <pattern value="/edit" /> 
    <view-id value="/views/edit.xhtml" />
</url-mapping> 

Is there any way to define all them using some wildcard, like this?

<url-mapping id="generic"> 
    <pattern value="/*" /> 
    <view-id value="/views/$1.xhtml" />
</url-mapping>

I know is possible to use EL in the view-id value, but I can manage it to work.


Its currently not possible to use a wildcard like this.

However as you already mentioned you could use a dynaview (EL expression for the view-id) to achieve something similar. We recently fixed a bug that prevented something like this to work correcty. Perhaps you could give 3.3.1-SNAPSHOT a try. My guess is that it will work fine now. Feel free to post a message on the forums if you have any further problems.


You might be better off using Rewrite which lets you do more powerful configuration:

https://github.com/ocpsoft/socialpm/blob/master/web/src/main/java/com/ocpsoft/socialpm/URLRewriteConfiguration.java

 .addRule(Join.path("/{page}").to("/views/{page}.xhtml"))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜