seam – 如何在pages.xml中指定重写模式
我在几个文件夹中有很多xhtml文件.我想重写网址为
从http://localhost:8080/folder1/file1.seam到http://localhost:8080/folder1/file1 在file1.page.xml中我给了 <rewrite pattern="/folder1/file1" /> 以上为我提供了正确的模式.但我有很多文件,我不想在每个page.xml文件中指定这个重写模式.有没有办法在pages.xml中指定它? 编辑: http://localhost:8080/folder2/file2.seam to http://localhost:8080/folder2/file2 http://localhost:8080/folder3/file3.seam to http://localhost:8080/folder3/file3 更多我翻译的样本
>重写基于重写发生
在pages.xml中为视图找到的模式 > Seam URL重写同时进行传入 和基于的传出URL重写 相同的模式 例: <page view-id="/home.xhtml"> <rewrite pattern="/home" /> </page> >任何传入的/ home请求都将发送到/home.xhtml > /home.seam?conversationId=13 重写规则可以将这些查询参数纳入其中 <page view-id="/home.xhtml"> <rewrite pattern="/home/{color}" /> <rewrite pattern="/home" /> </page> 对/ home / red的传入请求将被视为请求 如果color是页面参数,则传出的URLr /home.seam?color=blue将输出为 记得: >按顺序处理规则 如果你想隐藏会话ID,你可以这样做: <page view-id="/search.xhtml"> <rewrite pattern="/search-{conversationId}" /> <rewrite pattern="/search" /> </page> 现在/search.seam?conversationId=16将被写为/ search-16 如果要匹配多个页面,请使用通配符 <page login-required="true" view-id="/admin/*"> 希望这可以帮助 更新 要回答您的更新问题. 您可以使用外部重写创建通配符重写,但不能使用Seam的URL重写.使用基于视图的重写,您需要为每个视图ID声明一个模式,就像您描述自己一样.对不起,但这就是cookie崩溃的方式. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |